Hello all!,
I wrote this code making probes with the stochastic indicator:
- Long positions are opened when stochastic is in oversold several candles, price is over a moving average and there is a cross between the “K” and “D” lines.
- Short positions are opened with the opposite conditions.
Parameters are optimized for 5min EURUSD.
Results are got with 1.2 spread and 1000€.
My conclusion is the strategy could be positive but I think parameters are overfitted to get a good profit curve.
Feel free to comment, change, probe and improve the code!!
Andrés.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
DEFPARAM CumulateOrders = False //Parametros Estocastico indEstocastico = Stochastic[14,3](close) indMediaEstocastico = Average[5](Stochastic[14,3](close)) indMedia= ExponentialAverage[50000](close) //Condiciones para posiciones cortas valorEstacasticoMasBajo = lowest[NumeroVelasShort](Stochastic[14,3](close)) NumeroVelasShort = 4 NivelHigh= 87 DistanciaStopShort=60 DistanciaProfitShort=48 c1 = (valorEstacasticoMasBajo >= NivelHigh) c2 = close < indMedia c3 = (indEstocastico CROSSES UNDER indMediaEstocastico) IF c1 AND c2 AND c3 THEN SELLSHORT 1 CONTRACT AT MARKET set stop loss DistanciaStopShort*pointsize SET TARGET PROFIT DistanciaProfitShort*pointsize ENDIF //Condiciones para posiciones largass valorEstacasticoMasAlto = Highest[NumeroVelasLong](Stochastic[14,3](close)) NumeroVelasLong = 6 NivelLow= 15 DistanciaStopLong=65 DistanciaProfitLong=35 c6 = (close >= indMedia) c4 = (valorEstacasticoMasAlto <= NivelLow) c5 = (indEstocastico CROSSES OVER indMediaEstocastico) IF c6 AND c4 AND c5 THEN BUY 1 CONTRACT AT MARKET set stop loss DistanciaStopLong*pointsize SET TARGET PROFIT DistanciaProfitLong*pointsize ENDIF |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hi,
I try in EURUSD mini on IG market and It don’t run. Why ?
Thanks
I correct. It run but If I start the backtest from 1 january 2015. If I want to back starting from 1 January 2016 don’t run. why? Tanks
Hi volpiemanuele,
The problem is the high number of periods of the exponential average, 50000 (about 6 months). The program it doesn’t start until get this number of candles.
The solution would be to use
DEFPARAM PRELOADBARS = 50000
but I’m trying now and It doesn’t works, I don’t know why.
It works on ProRealTime CFD, but backtest begins since May 2014
Hola Andres, buen trabajo. Algun problema por usar la estrategia con acciones en time frame diario? Valdrian los mismos valores de variables?
Lo de la media de 50000 periodos no lo acabo de ver
Saludos
Hola Alex, no lo he probado en otros timeframes, pero con esta configuración específica no creo que funcione porque están muy ajustados los parámetros para este subyacente y para este timeframe.
La media simplemente es un filtro para entrar a favor de tendencia.
Por sí sola no es una estrategia que usaría en real. Quizá complementándola con otros indicadores/estrategias sí.
Un saludo.