Hello everyone,
I wanted to test a strategy that I used manually in Day Trading on the DAX in graphs 5 minutes.
The problem is that it is not always easy to backtest a manual strategy, particularly it is difficult to determine the slope of the moving averages, the levels of supports / resistances, etc.
So I slightly adapted the parameters for automatic trading.
We have a profit factor of 1.25 (spread included in the backtest) ; in manual trading I am rather at a profit factor of 1.5 (but exit rules are slightly different, on a trailing stop that is difficult to adapt) . I’m quite happy with my backtest that looks pretty close to reality. The strategy is very simple, it is the “KISS”, Keep It Simple and Stupid strategy. It uses only three moving averages, we trade with the trend.
Note that the test is positive in M5 timeframe (but I can only test it on 2,5 years), it is much worse on the upper timeframes.
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 44 |
Defparam cumulateorders = false Ctime = time > 080000 and time < 180000 MM200 = average[200](close) MM180 = average[180](close) MM20 = average[20](close) // ACHAT ca1 = MM20 > MM180 and MM180 > MM200 ca2 = MM200 > MM200[1] and MM180 > MM180[1] and MM20 > MM20[1] ca3 = close crosses over MM20 ca4 = close > open and close > close[2] ca5 = ADX[14] > 12 IF Ctime and ca1 and ca2 and ca3 and ca4 and ca5 THEN buy at market ENDIF Sell at MM180 stop // VENTE cv1 = MM20 < MM180 and MM180 < MM200 cv2 = MM200 < MM200[1] and MM180 < MM180[1] and MM20 < MM20[1] cv3 = close crosses under MM20 cv4 = close < open and close < close[2] cv5 = ADX[14] > 12 IF Ctime and cv1 and cv2 and cv3 and cv4 and cv5 THEN sellshort at market ENDIF Exitshort at MM180 stop // Clôture des positions le soir IF time = 200000 THEN sell at market exitshort at market 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
Simple and interesting code, Doc! I have a lot of fear of strategies below 15min TF 🙂 , I will trie this.
What about in other index? Is it still positive?
Thanks.
Andrés.
Hello,
I didn’t test it on other indexes. It was just like the way I traded manually the Dax.
Hi,
Without optimize variables and only in the last year:
Bad in Spain & France.
Good in Italy.
😉
Uffff, I didn’t adjust the different index spreads. With the heavy spread of Italy It’s negative too.
Good day. I know this was posted such a long time ago, but I though rebuilding the system on another platform might just seem worth the while. Testing it on multiple FX pairs, mostly USDJPY, USDCHF, USDCAD, GBPUSD and AUDUSD. Seem to have promise and this is over 5yrs data using 5m, 15m and 1hr timeframe. I did however add a position tracking mechanism. Again I did not write it on PRT.
Also to note that the one position in my code does not close the other, which as far as I know PRT does not allow hedging or maybe this was just IG stopping hedging.