Hello,
I developed this strategy that follows the trend (buy and sell). It’s based on 3 conditions only related with the exponential moving average.
It works better without target and stop loss.
It keeps positions open for a minimum of 24h.
You can backtest this strategy with different timeframe, but you’ll have to adapt R :
– R=200 for TF=30min
– R=100 for TF=1h
– R=50 for TF=2h
– R=25 for TF=4h
It gives good results with all the major indices and forex (TF=2H) :
– DAX, GL=3.07 (90 trades)
– FTSE, GL=2.20 (81 trades)
– CAC, GL=2.07 (86 trades)
– US500, GL=2.41 (69 trades)
– DOW, GL=1.83 (69 trades)
– US100, GL=1.65 (72 trades)
– ASX, GL=1.54 (96 trades)
– EURUSD, GL=1.95 (91 trades)
– GBPUSD, GL=1.43 (82 trades)
– USDJPY, GL=1.27 (75 trades)
These results are with the exact same code for each market with a timeframe=2H
You can easily get a better GL for each market by changing few settings, but the initial idea was to use the same code for all markets.
These backtests are with no spreads, and no fees, how much fees we can expect for 1 contrat on one of this market for a duration of 1 week open?
What are your ideas to improve this strategy?
Jérémy
DEFPARAM cumulateorders = false
positionSize = 1
SL = 0 // stop loss in %, set to 0 to not use TP
TP = 0 // target in %, set to 0 to not use SL
minimumBarKeepOpen = 12 // keep open at least 24h, as example if TF=2h then the calcul is 24/2h = 12
R = 50 // R=200 for TF=30min, R=100 for TF=1h, R=50 for TF=2h, R=25 for TF=4h
crossEntry = R * 1
crossExit = R * 2
period1 = R * 2
period2 = R * 2
period3 = R * 4
MM1 = Average[period1](close)
MM2 = Average[period2](close)
MM3 = Average[period3](close)
entryBuy = MM1 > MM1[crossEntry] and MM2 > close and MM3 > close
entrySell = MM1 < MM1[crossEntry] and MM2 < close and MM3 < close
exitBuy = shortonmarket and MM1 < MM1[crossExit] AND BarIndex - TradeIndex > (minimumBarKeepOpen - 1)
exitSell = longonmarket and MM1 > MM1[crossExit] AND BarIndex - TradeIndex > (minimumBarKeepOpen - 1)
IF not onmarket and entryBuy THEN
SELLSHORT positionSize SHARES AT MARKET
ENDIF
IF not onmarket and entrySell THEN
BUY positionSize SHARES AT MARKET
ENDIF
IF exitBuy THEN
exitshort at market
ENDIF
IF exitSell THEN
SELL AT MARKET
ENDIF
IF SL > 0 THEN
SET STOP %LOSS SL
ENDIF
IF TP > 0 THEN
SET TARGET %PROFIT TP
ENDIF