Hello all!,
I wrote this code making probes with the stochastic indicator:
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.
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
You must be logged in to post a comment.
It works on ProRealTime CFD, but backtest begins since May 2014
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.
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
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.