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 27 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

  • lmkwinlmkwin ✭✭
    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 28
    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.
Sign In or Register to comment.