Hi guys,
Open range breakout systems are very popular. They are simple and reliable with volatile instruments like the DAX. I trade the ORB together with the equity curve because as all breakout systems they could have some ugly drawdown phases. These concept is very easy and is described perfectly here in the Blog. Add to the equity curve a simple moving average and trade only if the curve is above the MA could help to avoid ugly losses.
I want to share an easy ORB strategy works profitable in M5 and M15 – this is not a big thing but maybe helpful for some PRT beginners.
have fun
Reiner
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
// Open Range Breakout DAX 5/15M // code-parameter DEFPARAM FlatAfter = 173000 // window high/low calculation ONCE StartTime = 90000 ONCE EndTime = 93000 // trading window ONCE BuyTime = 93000 ONCE SellTime = 173000 // money management ONCE Capital = 10000 ONCE Risk = 0.01 ONCE StopLoss = 10 ONCE equity = Capital + StrategyProfit ONCE maxrisk = round(equity*Risk) ONCE PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize) // fixed position size //ONCE PositionSize = 10 //signal line signal = Tema[5](close) // calculate high/low and sl/tp IF Time >= StartTime AND Time <= EndTime THEN IF TIME = StartTime THEN DailyHigh = High DailyLow = Low ENDIF IF High > DailyHigh THEN DailyHigh = High ENDIF IF Low < DailyLow THEN DailyLow = Low ENDIF sl = DailyHigh - DailyLow tp = sl TradeCounterLong = 0 TradeCounterShort = 0 ENDIF // position management IF Time >= BuyTime AND Time <= SellTime THEN // Long IF Not LONGONMARKET AND signal CROSSES OVER DailyHigh AND TradeCounterLong = 0 THEN // long IF (Time >= 93000 AND Time <= 113000) OR (Time >= 130000 AND Time <= 171500) THEN // no trading during lunch BUY PositionSize CONTRACT AT MARKET TradeCounterLong = TradeCounterLong + 1 ENDIF ENDIF // short IF Not SHORTONMARKET AND signal CROSSES UNDER DailyLow AND close < DClose(1) AND TradeCounterShort = 0 THEN IF Time >= 93000 AND Time <= 150000 THEN // short breakouts after 1500 are not profitable SELLSHORT PositionSize CONTRACT AT MARKET TradeCounterShort = TradeCounterShort + 1 ENDIF ENDIF // close positions IF Time = SellTime THEN IF LONGONMARKET THEN SELL AT MARKET ENDIF IF SHORTONMARKET AND Time = SellTime THEN EXITSHORT AT MARKET ENDIF ENDIF // stops and targets SET STOP LOSS sl SET TARGET PROFIT tp 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
dOES IT PERFORM WELL ALSO ON OTHER IDEX?
I have tested only the DAX
Hello Reiner
This looks very interesting and inspiring, thank you so much for sharing it with us and referring us to the concept here in the Blog.
Please would it be asking too much for you to include additional code to … add to the equity curve a simple moving average so that the your above TS trades only if the equity curve is above the MA … or would this be too much work for you please??
I am trying to do above myself, but not got it working so far.
Many Thanks
GraHal
Hi GraHal,
with the current PRT IG version the MA plotting on strategyprofit curve is not working correctly. I manually insert a ma in the backtest chart and decide from day to day.
best regards
Reiner
Hey Reiner. Been reading and testing the code tonight. I just wonder you have put ONCE in the beginning of every line on the money management
// money management
ONCE Capital = 10000
ONCE Risk = 0.01
ONCE StopLoss = 10
ONCE equity = Capital + StrategyProfit
ONCE maxrisk = round(equity*Risk)
ONCEPositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
Hi Hockeygrader,
Thanks for your comment.
Yes of course, you have to remove some ONCE-statements if variable position sizing should be used:
equity = Capital + StrategyProfit
maxrisk = round(equity*Risk)
PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
Sorry for the confusion.
best regards
Reiner
Hello Reiner,
Thanks for this nice code, as usual !
I’ve tested it in M15, on the DAX (I like M15 because there is sufficient historic data).
Without spread, it’s winning since late 2014
With 1 point spread, it’s loosing all money if we begin the test in 2008.Did I miss something ?
Your strategy is good and we could do something to improve it.Best regards,
Hi Reiner,
Great bit of code, I will definitely by using some of it in my own strategies. With the times adjusted correctly for UK time and 1 point spread I get the following results. Does this seem correct?
http://s33.postimg.org/gmfw86o7v/image.png
http://s33.postimg.org/obhsh0v17/image.png
The large versions are here:
http://postimg.org/image/obhsh0v17/
http://postimg.org/image/gmfw86o7v/
Hi Cosmic1,
Thanks for your feedback and sorry for the late answer. I only have 100.000 candles for backtest due that reason everything before 2015 is not clear for me. It works great since last May but has some drawdowns. But many things worked over the last month because of the volatility. I go with your picture that in 2014 this idea had troubles with the described parameters.
Best regards
Reiner
Please test it on demo first, as I’m not sure that plotting the MA on strategyprofit curve is working correctly with PRT-CFD. Work for sure with PRT software though. I’ll ask PRT next week if it is possible now, because it were not the case when I wrote this article about this concept some weeks ago.
Hi Nicolas! Is it possible too reference the MA in the equity curve so as too know whether too put a trade on or not?
Hey Reiner, Yes the 200k units comes in very handy and also causes a lot more work! Maybe it is something that can be adjusted to be workable over the long term?
Hi Reiner,
Can the code be changed to have a €2 per point risk/gain?
thanks
Hi thegeneral,change line 22:ONCE PositionSize = 2
best regards
Reiner
and of course select an DAX 1 Euro mini
Hey. Been comparing the strategys performance versus the DAX volatility index. i’ve not done all 100 000 bars yet but so far the strategy is profitable when the $VDAX is somewhere between 15 & 25. Gonna work on this tonight and see if a can give you some kind of report.
Hey Hockeytrader
did you back test this as you said you would do ? I am based in London, so do I have to choose Dax 30 ?
HELLO REINERARE YOU WORKING WITH THIS STRATEGY NOW?
HEVE YOU CHANGE SOMETHING IN THE CODE?
THANKS
ALE
ALE, breakout strategies work great in trend phases like last year. Unfortunately DAX is more or less catched in a range since Februar and you lost money with that kind of algos. No, I’m not trading these kind of strategies at the moment.
Ok, thanks
Hello,
what is the simple average period on equity curve ?
Thank you in advance
tradex, open the settings dialog (click on wrench symbol) on the equity curve window and add a simple moving average indicator – thats all. When your backtest based on e.g. 100.000 candles set a period length of 2000 or 5000. Trade only if the equity curve is above of the average is an easy method to increase the profit probability
how would you explain the fact that this robots stopped working pretty much at the exact period when it has been shared?
Is it just bad luck or it might be that sharing can affect negatively the profitability of an algorithm?
does anyone has thoughts about it?
Many thanks
Overfit on past history obviously. But it doesn’t mean that it would still underperformed in the future. That is why walk-forward is important, as long as over analysis tools like MonteCarlo for instance.
Thank you for the clarifications Nicolas, I am more aware of the meaning of the backtesting now, after spending the weekend on it. Thank you for the amazing job of this forum.
Hi all, could a simple indicator be made to mark the traditional Pit based ORB?
I’m trying to put together a similar indicator but struggling. I want to mark the NY Pit session (9:30 AM – 4:00 PM) each day for US500 with a vertical line and the opening 30 second range with a horizontal box. Could you or anyone help with this?
Kind Regards