I share the robot here, so we can improve it and show me the backtest with 200000 bars
// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
DEFPARAM FlatAfter =173000
once ordersize=1
HoraEntradaLimite = 090600
HoraInicio = 090500
if Ordersize>15 then
Ordersize=15
endif
if Time >= HoraInicio and time <= HoraEntradaLimite then
c1 = open < close-2
if not onmarket then
IF c1 THEN
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
ENDIF
endif
buy ordersize*6 contract AT close+2 stop
endif
c2= open > close-1
IF c2 THEN
iF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
endif
ENDIF
sellshort ordersize*6 contract AT close-1 stop
endif
endif
endif
SET STOP ptrailing 5 Q
Raul
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+
CNParticipant
Senior
Hey,
My broker has 4 as min. SL in dax.
What broker are you with?
Could you post the results? There’s no picutre
For 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.
Looks like it worked that time.
I’ll post updated results after Draghi finishes his press conferene
I made upgrade of forums during your last post, that’s why I believe the upload didn’t work at this time.
About the strategy result, is anybody using the tick/tick backtest already?
Thanks Nicolas. I’ve got it ticked when I run the backtest. I know, the equity curve looks unbelievable. I’ll post results of previous test (with Raul’s older version of the code) later. equity curve looks more like you’d expect
Hey 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 🙂
All
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.
// Definition of parameters
DEFPARAM CumulateOrders = false // No accumulation of orders
// The position is closed at 4:30 p.m., local market time (London).
DEFPARAM FlatAfter =162900
once ordersize=1
// No new positions after the candle closes at 08:06
EndTime = 080600
// Market analysis starts in the candle 5 minutes closes at 08:05
StartTime = 080500
// Max orders
if Ordersize>11 then
Ordersize=11
endif
// Risk & multiplier contracts
n=1
// Conditions for analysis
if Time >= StartTime and time <= EndTime then
// Conditions to enter long positions
c1 = open < close-1
IF c1 THEN
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2//+1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
endif
// If the first day of 5 bar min is positive, we buy
buy ordersize*n shares at market
endif
// Conditions to enter short positions
c2= open > close-1
IF c2 THEN
iF PositionPerf(1) < 0 THEN
OrderSize = OrderSize/2//+1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
ENDIF
// If the first day of 5 bar min is positive, we sell.
sellshort ordersize*n shares at market
endif
endif
SET STOP ploss 4 //5 3
SET TARGET pPROFIT 10 //10 12
AlcoParticipant
Senior
Great work jonjon.
But why do you use take profit instead of trailing? Are the results with tp better?
No, 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.
Beware 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 🙂
CNParticipant
Senior
Where do we find this code Nicolas?
These are the 2 different trailing stop blog articles:
MFE trailing stop
complete trailing stop function
CNParticipant
Senior
How would you add that/those to the code that Raul posted? And where?