BREAKOUT / BREAKDOWN FROM A RANGE

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4670 quote
    GraHal
    Participant
    Master
    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
    #4674 quote
    Nicolas
    Keymaster
    Master
    Hello 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.
    #4676 quote
    Jerry
    Participant
    New
    Hi 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…
    #4834 quote
    GraHal
    Participant
    Master
    Hi Guys and thank you both for your suggestions. As an example, I was thinking …
    1.  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
    #63246 quote
    dillongr
    Participant
    Junior
    Morning,  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
    defparam cumulateorders=false
    
    tradingtime=dayofweek>=1 and dayofweek<=5 and time>100000 and time <170000
    
    
    if time=100000 then
    RangeTop=highest[24](high[1])
    RangeBottom=lowest[24](low[1])
    endif
    
    box=RangeTop-RangeBottom
    TP1=box*1.1
    SL=box*.8
    pricezoneS=rangebottom*0.9
    pricezoneL=rangetop*1.1
    //TP2=box*1.62
    //TP3=box*2
    
    entryl= close >= rangetop and close <= pricezonel
    entrys=close<= rangebottom and close >= pricezones
    
    
    if not onmarket and tradingtime then
    if entryl then
    buy 1 contract at market
    //tc=1
    elsif entrys then
    sellshort 1 contract at market
    //tc=1
    endif
    
    endif
    
    //set profit to range height
    SET TARGET PROFIT TP1
    
    set stop loss SL
    GraHal thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

BREAKOUT / BREAKDOWN FROM A RANGE


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by dillongr
8 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/30/2016
Status: Active
Attachments: No files
Logo Logo
Loading...