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.

2-Bar Narrow Range

Need help in scanning this query , Toby Crabel – 2-Bar Narrow Range (NR) pattern is defined as the narrowest range from high to low of any two day period relative to any two day period within the previous 20 market days (Look_Back).

Comments

  • lmkwinlmkwin ✭✭
    In ChartSchool there is an article on the Crabel NR7. Link below. There are some scan examples that you can use to find that. You should be able to modify those lines to meet your needs I think.


    https://chartschool.stockcharts.com/table-of-contents/trading-strategies-and-models/trading-strategies/narrow-range-day-nr7

    NR7 in Uptrend After Pullback
    This scan reveals stocks that have just had an NR7 day during an uptrend (as indicated by the Aroon indicator values) and whose CCI values indicate an oversold condition.

    [type = stock]
    and [country = us]
    and [daily sma(20,daily volume) > 100000]
    and [daily sma(60,daily close) > 20]
    and [Range < 1 day ago Min (6, Range)]
    and [today's high < yesterday's high]
    and [today's low > yesterday's low]
    and [Min (5, CCI(10)) < -100]
    and [Aroon Up (63) > Aroon Down(63)]
  • This seems to be valid grammatically, but it doesn't produce results. I don't know if that's because there really aren't any results, or if the logic is wrong.

    [group is sp500]
    and [[min(2,high) - max(2, low)] < min(20, min(2,high) - max(2, low) ) ]

    You could try writing it out long hand. Each time you add a new day, your get fewer results.


    and [max(2,high) - min(2, low) < 20 days ago max(2,high) - 20 days ago min(2, low) ]
    and [max(2,high) - min(2, low) < 19 days ago max(2,high) - 19 days ago min(2, low) ]
    and [max(2,high) - min(2, low) < 18 days ago max(2,high) - 18 days ago min(2, low) ]
    and ... etc.

    Or, this isn't perfect, but it's shorter and it may be a reasonable approximation.

    [group is sp500]
    //and [ATR(2) < ATR(20)*.7]

    For any solution, you might want to add a few conditions as suggested above in the previous post to minimize false hits.
  • lmkwinlmkwin ✭✭
    This also seems to "work" and get results.

    and [Range(2) < 1 day ago Min (20, Range(2))]

    I put ATR2 on the chart and a 20 Price Channel overlay on that to "test". Hey, maybe that's another way to scan perhaps

    ATR2 < than 1 days ago Lower Price Chan 20, ATR2
  • Thank you Imkwin and markd , I am overwhelmed with your response @ markd is this syntax of writing the scan correct : [group is sp500]
    and [[min(2,high) - max(2, low)] < min(20, min(2,high) - max(2, low) ) ], Kindly check this

    @ Imkwin : ATR2 < than 1 days ago Lower Price Chan 20, ATR2 Kindly elaborate do you mean, ATR2 < 1 day ago(min(20, ATR(2)
  • markdmarkd mod
    edited March 26
    Sorry, wrong version. I was experimenting and gave you the version that gets hits, some of which look right, but others don't. The syntax is correct but I think the logic is wrong. It takes subtracts the higher low from the lower high. That's not the two day range.

    This is the one that I think is logically correct but doesn't get hits for the many dates I sampled. That seems improbable, so I'm not sure what's wrong. It subtracts the two day low from the two day high, which seems to be the right thing to do. However, I'm not sure whether you can really do reliable calculations inside the max and min functions, even though it passes syntax and the first version gets results. The documentation doesn't show that you can, but it doesn't say you can't, either. That might be a question for Support.

    and [max(2,high) - min(2, low) < min(20, max(2,high) - min(2, low) ) ]
  • @lmkwin

    I don't think 'range(2)' is valid. In an 'and' statement it doesn't kick out an error, but if you do

    rank by range(2)

    it says unrecognized characters after rank by. If you say

    rank by range

    it's ok with it. Also, range( ) doesn't show up as a function on the 'Technical Functions' page in the documentation. I think we've seen this before where the syntax checking is not really comprehensive.
  • lmkwinlmkwin ✭✭
    "@ Imkwin : ATR2 < than 1 days ago Lower Price Chan 20, ATR2
    Kindly elaborate do you mean, ATR2 < 1 day ago(min(20, ATR(2)"

    and [ATR(2) <= 1 days ago Lower Price Chan(20,ATR(2))]

    The Price Channel 20 on the ATR2 would show the max/ high value (Upper Price Channel) for the ATR2 in the last 20 periods, as well as the min/ lowest value (Lower Price Channel) for the ATR2

    I put ATR2 and the Price Channel 20 overlay on the indicator to "check" results and thought that might be another option to use in your endevour.

    @markd. I did get "results" with Range(2) but the Rank by returned Range value. I didn't think it would work either, but checking syntax accepted it but the results using ATR2 and the Price Channel, it didn't seem like the Range(2) was actually working.

    That's why I suggested ATR2 as an option. It's not exactly what was requested but it could be a close enough option if the Min/Max math version doesn't work out.
  • Thanks @Imkwin for clarification , I tried using ATR(2) and Lower Price Chan got some good hits ...Thanks for the scan
  • @markd I also tried your scan as well got some( a few of them ) good results by using this>> [[min(2,high) - max(2, low)] < min(20, min(2,high) - max(2, low) ) ] ...Thank you......Any other suggestion to scan for tight range please do put forward
  • I think the reason that 'works' is that min2high-max2lo essentially can be satisfied by an inside bar (lower high and higher low vs. previous bar), which is likely to occur in a narrow range environment - but also elsewhere, e.g. after a very wide range bar that closes near the middle, which is why you get a lot of junk as well.

    Bollinger Band Squeeze is a well-known narrow range scan. Should be in the documentation.
Sign In or Register to comment.