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/10/2017 at 10:34 AM #4889010/18/2017 at 12:15 PM #49818
I 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 stopendifLine 24 should be close< ema,
This strategy sounds interesting, let me know if is working
10/18/2017 at 12:57 PM #4982511/07/2017 at 7:42 AM #51760Here is a link to a webinair that talks about this strategy https://brookstradingcourse.com/webinars-lectures/futures-io-webinar-trading-opening-breakouts-reversals/
1 user thanked author for this post.
02/20/2018 at 7:11 AM #63247Hi, I have simplified my code, but have a small problem. I only want orders to be placed within 10% of the bottom / top of range. Range is the 2nd 4hr candles, and entry is based on 10 min bar closing outside the range. I am getting orders placed after I have taked profit, which is to far from the range. any ideas how to solve that?
12345678910111213141516171819202122232425262728293031323334353637defparam cumulateorders=falsetradingtime=dayofweek>=1 and dayofweek<=5 and time>100000 and time <170000if time=100000 thenRangeTop=highest[24](high[1])RangeBottom=lowest[24](low[1])endifbox=RangeTop-RangeBottomTP1=box*1.1SL=box*.8pricezoneS=rangebottom*0.9pricezoneL=rangetop*1.1//TP2=box*1.62//TP3=box*2entryl= close >= rangetop and close <= pricezonelentrys=close<= rangebottom and close >= pricezonesif not onmarket and tradingtime thenif entryl thenbuy 1 contract at market//tc=1elsif entrys thensellshort 1 contract at market//tc=1endifendif//set profit to range heightSET TARGET PROFIT TP1set stop loss SL02/20/2018 at 8:16 AM #6325302/20/2018 at 8:23 AM #63255Maybe try this, it will only create one set of stop orders for the day;
1234567891011121314151617181920212223242526272829303132defparam cumulateorders=falsetradingtime=dayofweek>=1 and dayofweek<=5 and time>100000 and time <170000If hour = 1 ThenTD = 1ElsIf hour = 10 and minute = 0 thenRangeTop=highest[24](high)[1]RangeBottom=lowest[24](low)[1]endifbox=RangeTop-RangeBottomTP1=box*1.1SL=box*0.8pricezoneS=rangebottom - (box*0.1)pricezoneL=rangetop + (box*0.1)If TD = 1 and on market ThenTD = 0EndIfif TD = 1 and not onmarket and tradingtime thenbuy 2 contract at pricezoneL stopsellshort 2 contract at pricezoneS stopendif//set profit to range heightSET TARGET pPROFIT TP1set stop ploss SL//GRAPH RangeTop coloured(255,0,0) AS "RangeTop"//GRAPH RangeBottom coloured(0,255,0) AS "RangeBottom"02/20/2018 at 11:48 AM #63282Thanks Juan,
That still produces multiple orders, I only want 1 long or 1 short per day. Once target is hit, we wait for the next day. I am using this on the GBP pairs manually right now with great success (it is basically the London Breakout strategy)
02/20/2018 at 1:09 PM #63290Ok got it like I wanted, now to test on GBP pairs
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647defparam cumulateorders=falseonce order = 0tradingtime=dayofweek>=1 and dayofweek<=5 and time>100000 and time <170000if time=100000 thenRangeTop=highest[24](high[1])RangeBottom=lowest[24](low[1])order = 0endifbox=RangeTop-RangeBottomTP1= box*1.5SL=box*1.1pricezoneS=rangebottom*0.9pricezoneL=rangetop*1.1//TP2=box*1.62//TP3=box*2entryl= close >= rangetop and close <= pricezonelentrys=close<= rangebottom and close >= pricezonesif not onmarket and not order and tradingtime thenif entryl thenbuy 1 contract at marketorder = 1//tc=1elsif entrys thensellshort 1 contract at marketorder = 1//tc=1endifendif//set profit to range heightSET TARGET PROFIT TP1set stop loss SL1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on