At the request of Ashley, I tried to backtest a strategy.
It was a failure on M15 and H1.
But the code works well for these conditions :
- H4 timeframe
- only long positions (works not great with shorts)
On H1, we must use « sell limit » instead of « buy stop », it works with it !
So this code isn’t my best strategy of course, but the equity curve is sexy 🙂
PS : désolé pour les francophones exclusifs, mais la traduction n’est pas très dure…
Voici le code du BACKTEST :
// ASHLEY's strategy // EUR/USD H4 minicontracts EMA21 = exponentialaverage EMA40 = exponentialaverage EMA100 = exponentialaverage n = 4 Ctime = time > 040000 and time < 200000 // ACHAT ca1 = EMA21 > EMA40 and EMA40 > EMA100 ca2 = EMA21 > EMA21 and EMA40 > EMA40 and EMA100 > EMA100 ca3 = low < EMA21 and close > EMA21 ca4 = close > open and close > close and close > open and open <= open and open <= close IF Ctime and ca1 and ca2 and ca3 and ca4 and not longonmarket THEN SL = close - low buy n shares at highest(high) stop ENDIF set stop loss SL set target profit SL * 1.5