ATR vs SPY Scan

What would the code be to scan for stocks by comparing the volatility of the stocks (as measured by the 14-Day ATR/ Closing Price) to a minimum threshold for the SPY, like the SPY ATR(14) / Closing Price of the SPY x 2? i.e. show me all the stocks that are twice as volatilite as the SPY based on 14-day ATR relative to price.

Comments

  • Unfortunately, in a scan you cannot specify an indicator value for a specific symbol. Instead, you have to determine the indicator value from the symbol's chart, or, in your case, calculate the ratio of the indicator value to price separately, then plug the result into your scan as one side of the comparison.

    So, if the SPY ATR to price ratio is .009, the scan would be

    and [ atr(14)/close > .009 * 2]