Andres

Stochastic EURUSD 5min strategy

Category: Strategies By: Andres Created: May 20, 2016, 5:24 PM
May 20, 2016, 5:24 PM
Strategies
6 Comments
Stochastic EURUSD 5min strategy

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.

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

 

Download
Filename: Estocastico-EURUSD-5min.itf
Downloads: 417
Andres
Andres Average
Developer by day, aspiring writer by night. Still compiling my bio... Error 404: presentation not found.
Author’s Profile

Comments

Andres
10 years ago
#

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.

alex224
10 years ago
#

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

Doctrading
10 years ago
#

It works on ProRealTime CFD, but backtest begins since May 2014

Andres
10 years ago
#

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.

volpiemanuele
10 years ago
#

 Hi,

I try in EURUSD mini on IG market and It don't run. Why ?

Thanks

volpiemanuele
10 years ago
#

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

ProRealCode ProRealCode
Loading...