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.

Help - Scan for Strong Close?

edited March 2021 in Scanning
I want to scan for stocks that moved more that 1ATR and closed in the upper 25% of their daily range. I tried the following:

[Range > ATR(14)] and [Close > High - Range/4], but I get the same results with or without that second clause. Is it possible that every stock that has a range greater than its ATR closed in the top 25% of its range, or is something off here?

Also, will everything on one side of the '>' be grouped automatically? I tried [Close > (High - Range/4)] (adding parentheses) and it could not parse the phrase.

Comments

  • I get different results removing the individual clauses.

    Close in the Upper half of Range, would be [Close > Range/2 + Low] I believe

    Use Rank by Range/2 + Low to see the value of the calculation.

  • Yeah, look at that. It filters for stocks that closed in the upper 25% of their range if I write Close > Range/1.33 + Low, but not if I write Close > High-Range/4. Weird
  • markdmarkd mod
    edited March 2021
    In the scan language, parentheses ( ) are reserved for functions like min( ), max( ), etc. and indicators like sma( ), MACD( ... ), etc. That's why the scan engine had trouble with one of your attempts.

    So, if you want to group arithmetic operations (which is a very good idea - I know I can never remember the order of precedence), use brackets [ ].

    Also, I think it's easier (more flexible, and maybe more legible) to use decimals for fractions instead of division, whenever that's possible.

    So, you could do your scan like this:

    [group is SP500]
    and [range > ATR(14)]
    and [close > low + [range * .75] ]

    If you see from your results that a different fraction might narrow (or widen) the results in a good way, its easy to fine tune the decimal - maybe to .85, maybe to .65.

    Also, when testing, it helps to test against a known number of stocks, as in an index like DOW30, sp100, sp500, sp400 sp600. If your scan returns the same number of results as there are stocks in the index, there's probably something wrong with the scan (or the scan conditions are not unique enough to be useful), which you can verify by looking at a limited number of symbols.

    If you don't limit your "universe", and you get a result of 999 symbols, you don't know whether it was just a one way day (like Friday) or whether your scan is wrong, and its much harder to tell by reviewing the results.

    p.s. - if you don't want to use an index, you can write your own universe conditions - .e.g. group is energy and market cap > 100 and SCTR > 50. Then run JUST that universe condition to see how many there are. Then add the rest of your conditions and compare the result total to the universe total.
  • Yes, this helps too. Thank you.
  • Having trouble again. If I don't want price to fall more than 1%. [Close > [High - Close] *.001] doesn't seem to get what I'd like to see but I am getting kind of foggy now. Been at it all day long.
  • lmkwinlmkwin ✭✭
    edited March 2022
    Think of 1.00 as the baseline. Price * 1.00 is the price. Price * 0.95 is 5% less than price. 1.05 is 5% more than the price. .01 is 99% less. .001 is 99.9% less.
  • and High - Close is going to be a value difference between the H and C. High will never be less than C, but can be equal, slightly higher, or significantly higher.

    Close: 10 High: 11 H-C = 1. 10>1 * (anything up to 9.999999)

    Close: 10 High: 10 H-C = 0. 10>0 * (anything)

    Close: 10 High: 20 H-C = 10. 10>10 * (anything 0.99999 and below)
Sign In or Register to comment.