New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Breakout from Consolidation

Please help me scan: 30 or more consolidating small bars and produce a Red bar 2X the range of the previous 30 Bars for a Bearest condition
and Vice Versa producing a green Bar for the Bullish condition.
Thanks

Comments

  • 2X the range of the largest of the previous 30 bars
  • edited January 2022
    MarkD....Is this the scan code?.....

    Bullish

    [1 day ago Upper Price Chan(20) = 30 days ago Upper Price Chan(20)]
    and [close x Upper Price Chan(20)] for Bullish

    Bearest?


  • ................


  • [1 day ago Upper Price Chan(20) = 30 days ago Upper Price Chan(20)]

    The "30" in "30 days ago" cannot be greater than the length of the price channel ("20"), because after 20 bars the start of the price channel will move to the next bar, so the channel today will no longer be equal to the channel value the day before - in other words, the upper channel will no longer be flat.

    So, if you want to test for 30 days of flat channel, you need a channel longer than 30 - maybe at least 35, or maybe 40 or 45. You have to experiment:

    [1 day ago Upper Price Chan(40) = 30 days ago Upper Price Chan(40)]


    You can get the largest range of the last 30 bars (before today) from a max( ) function, so maybe

    and [range > 1 day ago max(30, range)]

    For a bearish breakout, use Lower Price Chan( ). Also, for the break, have the Lower Price Chan( ) x close.
  • edited January 2022

    ..........
  • Add actual price channels to see what works. Hand drawn channels can be deceptive.
  • Thanks MarkD for your help
Sign In or Register to comment.