Stochastic Gold Trader

Category: Strategies By: juanj Created: August 14, 2020, 8:53 AM
August 14, 2020, 8:53 AM
Strategies
29 Comments

I have been trading Gold more than usual recently and made an interesting observation regarding the trend waves moving very much in sync with the stochastic. So this prickled my curiosity enough to quickly code-up a strategy based on my observation. And despite the fact that I purposefully fine tuned (aka curve fitted) the stochastic parameters I still think the result is rather promising considering there really isn’t that many essential moving parts outside of the stochastic settings. Also as a professional PRT developer I no longer have the liberty of sharing as many strategies to the community as before, so I sincerely hope there is something that someone here might find useful.

Defparam cumulateorders = False

possize = 1

StochUpperLimit = 90
StochLowerLimit = 10
StochConsolidationPeriod = 2

StochPeriods = 18
StochK = 2
StochD = 6

StochSignal = Stochastic[StochPeriods,StochK](close)
StochMain = average[StochD](StochSignal)

RSI2 = RSI[2](close)

RSIUpperLimit = 95
RSILowerLimit = 5

RSILimit = 4

once Stoch = 0
once StochCounter = 0
once RSICounter = 0
once RSICounterAdj = 0
once LastRSI = 50

If Stoch = 0 and lowest[StochConsolidationPeriod](StochSignal) < StochLowerLimit and StochSignal[1] <= StochMain[1] and StochSignal > StochMain Then
 Stoch = -1
 StochCounter = 0
ElsIf Stoch = 0 and highest[StochConsolidationPeriod](StochSignal) > StochUpperLimit and StochSignal[1] >= StochMain[1] and StochSignal < StochMain Then
 Stoch = 1
 StochCounter = 0
EndIf

StochCounter = StochCounter + 1

If onmarket = 0 and Stoch -1 and StochCounter > 1 and StochSignal[1] <= StochMain[1] and StochSignal > StochMain Then
 Buy possize contract at market
 StochCounter = 0
 RSICounter = 0
 RSICounterAdj = 0
 LastRSI = 50
ElsIf onmarket = 0 and Stoch = 1 and StochCounter > 1 and StochSignal[1] >= StochMain[1] and StochSignal < StochMain Then
 Sellshort possize contract at market
 StochCounter = 0
 RSICounter = 0
 RSICounterAdj = 0
 LastRSI = 50
EndIf

If longonmarket and RSI2[1] >= RSIUpperLimit and RSI2 < RSIUpperLimit Then
 RSICounter = RSICounter + 1
 If highest[8](RSI2) < LastRSI Then
  RSICounterAdj = RSICounterAdj + 1
 EndIf
 LastRSI = highest[8](RSI2)
ElsIf shortonmarket and RSI2[1] <= RSILowerLimit and RSI2 > RSILowerLimit Then
 RSICounter = RSICounter + 1
 If lowest[8](RSI2) > LastRSI Then
  RSICounterAdj = RSICounterAdj + 1
 EndIf
 LastRSI = lowest[8](RSI2)
EndIf

If longonmarket and RSI2[1] < RSIUpperLimit and RSI2 >= RSIUpperLimit and RSICounter >= RSILimit-RSICounterAdj Then
 sell at market
 Stoch = 0
ElsIf shortonmarket and RSI2[1] > RSILowerLimit and RSI2 <= RSILowerLimit and RSICounter >= RSILimit-RSICounterAdj Then
 exitshort at market
 Stoch = 0
EndIf

//Graph RSICounter
//Graph RSILimit coloured(255,0,0)
//Graph RSICounterAdj coloured(0,255,0)

Download
Filename: Stochastic-Gold-Trader.itf
Downloads: 1822
juanj Master
My name is Juan Jacobs and I am an algorithmic trader and trading coach. After 7 years of corporate work as a Systems Analyst, I have decided to pursue my passion of trading on a full-time basis. My current focus area is that of 'smart' strategies based on 'Machine Learning'. You can find me at www.FXautomate.com or visit my PRC Marketplace Store here: https://market.prorealcode.com/store/fxautomate/
Author’s Profile

Comments

Logo Logo
Loading...