open range strategy code – lot of success
Forums › ProRealTime English forum › ProOrder support › open range strategy code – lot of success
- This topic has 38 replies, 10 voices, and was last updated 6 years ago by dillongr.
-
-
10/08/2017 at 8:31 AM #48596
Hi,
I have had a lot of success with an open range break strategy and I am trying to see if I can automate the strategy, but my limited knowledge of coding is proving to be a challenge
I am trying to define the opening range on the 5 min, for a set period of time. using the dax as an example:
- open range is high and low of 5 min candles between 8am and close of the 8:55 five min candle.
- entry is 2nd 5 min close above /below the range
- exit is a Fibonacci expansion of, 261.8
very simple and reliable in my intraday trading on SAF40, Dax, Dow, FTSE and US500.
Does anyone know how you define the range?
10/08/2017 at 11:30 AM #48614Hi dillongr
try something like this for high (hh) you can also use it as an indicator by “return hh” to see that the time are in right place
123456789101112starttime = 080000endtime = 085959if intradaybarindex=0 thenhh = 0endifif time>=starttime and time<=endtime thenif high>hh thenhh = highendifendif10/08/2017 at 11:32 AM #4861510/08/2017 at 12:26 PM #4861810/08/2017 at 1:10 PM #48620thanks Eric!
SL is normally at the top or bottom of the range depending if you are long or short. Price normally comes to test the 50% Fibonacci of the range before continuing on the breakout. I also use a 15ema to confirm trend direction
10/08/2017 at 2:36 PM #4862110/08/2017 at 2:41 PM #48622Entry condition you write the second close outside the range. Shall this two closes be consecutive?
And tagte is the 261.8% fibs expansion. So if the range is 100 points wider you have a take profit of 261.8 points above the range top? This is far away!
10/08/2017 at 3:18 PM #48623I coded this here with a profit target at the 161.8% fibo extension (that was already bad enough) and at least for the dax the result was not very promising.
Here is the code if you want to play with it:
Morning range break out system1234567891011121314151617181920212223242526272829303132333435defparam cumulateorders=falsetradingtime=dayofweek>=1 and dayofweek<=5 and time>=90000MA=ExponentialAverage[15](close)once tc=0if time=90000 thenRangeTop=highest[11](high[1])RangeBottom=lowest[11](low[1])endifif intradaybarindex=0 thentc=0endifCL=close>RangeTop and close[1]>RangeTopCS=close<RangeBottom and close[1]<RangeBottombox=RangeTop-RangeBottomif not onmarket and not tc and tradingtime thenif CL and close>MA thenbuy 1 contract at markettc=1elsif CS and close>MA thensellshort 1 contract at markettc=1endifset target pprofit box*1.618endifif longonmarket thensell at RangeBottom stopelsif shortonmarket thenexitshort at RangeTop stopendif1 user thanked author for this post.
10/08/2017 at 6:35 PM #48644Same code as Despairs but without EMA15 and a time end for buy at 09:16, tested with 1 WF at 60% resulted in fib 1,5 on OMX 30.
Andy
Breakout with fib 1,5123456789101112131415161718192021222324252627282930313233343536defparam cumulateorders=falsetradingtime=dayofweek>=1 and dayofweek<=5 and time>085900 and time<091600once tc=0if time=090000 thenRangeTop=highest[11](high[1])RangeBottom=lowest[11](low[1])endifif intradaybarindex=0 thentc=0endiffib=fibCL=close>RangeTop and close[1]>RangeTopCS=close<RangeBottom and close[1]<RangeBottombox=RangeTop-RangeBottomif not onmarket and not tc and tradingtime thenif CL thenbuy 1 contract at markettc=1elsif CS thensellshort 1 contract at markettc=1endifset target pprofit box*fibendifif longonmarket thensell at RangeBottom stopelsif shortonmarket thenexitshort at RangeTop stopendif10/08/2017 at 6:43 PM #4865110/08/2017 at 7:42 PM #4865910/08/2017 at 7:46 PM #4866010/08/2017 at 7:52 PM #4866110/08/2017 at 8:37 PM #4866410/08/2017 at 9:37 PM #48667 -
AuthorPosts
Find exclusive trading pro-tools on