intraday DAX strategy 5min mini1€ spread 1
Forums › ProRealTime English forum › ProOrder support › intraday DAX strategy 5min mini1€ spread 1
- This topic has 502 replies, 34 voices, and was last updated 4 years ago by Asteriks.
-
-
01/19/2017 at 1:16 PM #21674
I share the robot here, so we can improve it and show me the backtest with 200000 bars
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253// Definición de los parámetros del códigoDEFPARAM CumulateOrders = false // Acumulación de posiciones desactivadaDEFPARAM FlatAfter =173000once ordersize=1HoraEntradaLimite = 090600HoraInicio = 090500if Ordersize>15 thenOrdersize=15endifif Time >= HoraInicio and time <= HoraEntradaLimite thenc1 = open < close-2if not onmarket thenIF c1 THENIF PositionPerf(1) < 0 THENOrderSize = OrderSize/2if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2if ordersize<1 thenordersize=1ENDIFendifbuy ordersize*6 contract AT close+2 stopendifc2= open > close-1IF c2 THENiF PositionPerf(1) < 0 THENOrderSize = OrderSize/2if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2if ordersize<1 thenordersize=1endifENDIFsellshort ordersize*6 contract AT close-1 stopendifendifendifSET STOP ptrailing 5 Q01/19/2017 at 2:01 PM #21677Raul
I tested the code above from 2013. You lose all of your equity by Q2 2013 even with starting equity of EUR20k.
I then tested it with a stop and target as per previous versions. With Stop 5, Target 10. Unfortunately you again lose all of your equity by mid 2013 (even with EUR20k starting equity).
I (hopefully) attach the results from backtest with Stop 3, Target 12. You again need starting equity of EUR20k. Note the drawdown of EUR23k (I’m not sure I could live with that) and the large number of contracts you are sometimes trading (not sure how realistic). It performs really well 2014+
01/19/2017 at 2:35 PM #2168001/19/2017 at 2:45 PM #21683For some reason the files won’t upload. I didn’t receive any error messages this time though. If I figure it out I’ll post the results. Sorry guys.
I use Marex for most of my trading. I haven’t signed up to a broker yet to trade through PRT. Will do when happy with the demo results. Sounds like I’ll be looking at a stop of 4 like you guys. As I mentioned on the previous thread a SL of 4 and Target 10 also worked well.
01/19/2017 at 2:47 PM #2168601/19/2017 at 2:47 PM #2168701/19/2017 at 2:57 PM #2169101/19/2017 at 2:59 PM #21692Hey guys!
Thanks for sharing! Tested it on PRT 10.3 with IG and this is the result. Really promising if you ask me!
I will look into the code a bit more and see if I can make it better 🙂
01/19/2017 at 3:19 PM #21695All
In the previous discussion I was asked to provide the results from Raul’s earlier code. The code has changed somewhat into the version above however I’ll paste the previous version here and attach the results. NOTE: the code below is an older version (I don’t want to cause confusion).
I’ve made it quite conservative and have run it with SL of 4 (instead of 3 that I previously used) and Target 10. Max order size 11. I’m happy to forfeit % return to minimise drawdowns and err on side of caution. I’ve run backtest with tick-by-tick and the equity curve is more that you’d expect. In particular you can see “steps” up in the curve that we discussed, with slow gradual tail-offs through losses before the next “step”. 2013 clearly isn’t a good year (although not too bad). 2014+ good.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960// Definition of parametersDEFPARAM CumulateOrders = false // No accumulation of orders// The position is closed at 4:30 p.m., local market time (London).DEFPARAM FlatAfter =162900once ordersize=1// No new positions after the candle closes at 08:06EndTime = 080600// Market analysis starts in the candle 5 minutes closes at 08:05StartTime = 080500// Max ordersif Ordersize>11 thenOrdersize=11endif// Risk & multiplier contractsn=1// Conditions for analysisif Time >= StartTime and time <= EndTime then// Conditions to enter long positionsc1 = open < close-1IF c1 THENIF PositionPerf(1) < 0 THENOrderSize = OrderSize/2//+1if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2endif// If the first day of 5 bar min is positive, we buybuy ordersize*n shares at marketendif// Conditions to enter short positionsc2= open > close-1IF c2 THENiF PositionPerf(1) < 0 THENOrderSize = OrderSize/2//+1if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2ENDIF// If the first day of 5 bar min is positive, we sell.sellshort ordersize*n shares at marketendifendifSET STOP ploss 4 //5 3SET TARGET pPROFIT 10 //10 1201/19/2017 at 3:26 PM #2169901/19/2017 at 3:38 PM #21700No, it’s great work Raul. I just ran a few backtests and learned how to post the results 😉
With regards trailing vs take profit: I haven’t had time to look into it. I ran the test on the latest code with trailing stop of 5. That’s it (see posts above). If I have time I’ll look into it. For now I’m more interested in the entry prices that I’m getting paper trading.
01/19/2017 at 4:33 PM #21707Beware of stop trailing at 4 points, I don’t think that’s possible with IG. I encourage using the “now well known” trailing stop code snippet of the blog instead of the built-in trailing function, much easier to debug into real trading, IMO 🙂
01/19/2017 at 4:34 PM #2170801/19/2017 at 5:16 PM #21715These are the 2 different trailing stop blog articles:
01/19/2017 at 5:28 PM #21717 -
AuthorPosts
Find exclusive trading pro-tools on