BREAKOUT / BREAKDOWN FROM A RANGE
Forums › ProRealTime English forum › ProOrder support › BREAKOUT / BREAKDOWN FROM A RANGE
- This topic has 4 replies, 4 voices, and was last updated 7 years ago by
dillongr.
-
-
03/30/2016 at 10:28 PM #4670
Hello Everyone
May I please ask for any ideas or code snippets to get me started or even a full ‘Auto System’ to perform the following …
Breakout or Breakdown from a Range.
The sort of range I am thinking of are usually tightish / narrowish and often seen as consolidation after a strong rise up or down.
Please refer me to any existing systems on this website or anywhere that you feel may do the job?
Hope above makes sense, just say if not.
Many Thanks
GraHal
03/31/2016 at 7:31 AM #4674Hello GraHal,
This is not very difficult to code this kind of strategy, but how you would define a range after a strong rise up or down? A range is easy to spot with charts in front of human eyes, but not so with a mathematical process and that’s where the problem is. I would say that bollinger bandwidth may do the job for what you want to do here, take a look on it and maybe try to build a strategy around it.
03/31/2016 at 9:01 AM #4676Hi GraHal,
As Nicolas says, what are the exact specifications for this range? Start by defining these as simple text and then we could help you turn it into code. Something like (on a day chart):
- Look two weeks back, what is the highest high that gets hit at least two times with at least four days space in between? Define that price level as X.
- Look two days back, is it above X? If yes, look one days back, is it above X? If yes, look today, is it still above X? If yes, upward breakout confirmed, do something.
- If no to any of the above, breakout not confirmed, go back to first point, do nothing.
Something like that…
04/04/2016 at 3:19 PM #4834Hi Guys and thank you both for your suggestions.
As an example, I was thinking …
- If a run up / run down of N points followed by a trading in a (narrow) range of N1 points over N2 bars (often a near horizontal channel can be seen) then if …
Breakout above highest high over N2 bars – go Long.
Breakdown below lowest low over N2 bars then SellShort.
I would use PositionPerf = – N3 to get me out of the Trade.
I often trade manually as above and it more often than not gives me profit if I am nimble enough to get out before it retraces too much!
I would use backtest to optimise the value of N, N1, N2 and N3.
Many Thanks
GraHal
02/20/2018 at 7:05 AM #63246Morning, I have been playing with this again and have simplified the code but I only want orders to be placed within 10% of the break of the range. Right now new orders get placed as soon as I take profit, any ideas how to make sure that does not happen? this is the current code
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 SL1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on