Volatility Indicator/Scan based on Extreme Range for ThinkorSwim

I've been working on a way to assess equities based on the "smoothness" of their price action. Smooth price action gives clearer signals and fewer false signals. This code is based on the concept of Extreme Range, which is similar to True Range, but captures a fuller picture of the maximum price change between each bar and the next; it's looking for the bar-bar choppiness while ignoring any tradeable swings or trends.

The method is to calculate the Extreme Range series, aggressively de-trend it, average it over time, then express it as a percentage of the stock price. By default, it averages over 50 bars and sets a threshold of 3% of stock price. All adjustable, of course.


#-- XRI (Extreme Range Index)
#-- MoneyMagnet (2020)

declare lower;
input NoisePeriod = 3;
input ScorePeriod = 50;
input Threshold = 3;

def XR = CompoundValue(1, if AbsValue(low - XR[1]) > AbsValue(high - XR[1]) then low else high, high);
def Noise = Average(AbsValue(XR - MovingAverage(AverageType.Hull, ohlc4, NoisePeriod)), ScorePeriod);

plot XRI = Noise / ohlc4 * 100;
plot Thresh = Threshold;
plot Zero = 0;
AddLabel(yes, XRI, Color.YELLOW);

I am using it to find stocks that have lower risk, though they may also have little tradeable price movement. That can be screened for using other tools.

Share link: http://tos.mx/3gzlJYK
Last edited by a moderator:
It's intended to provide a way to see how choppy a stock's price action is, relative to the price of the stock. I use it to determine which stocks (lower number, therefore less choppiness) I will be willing to trade. By avoiding the more volatile stocks, I hope to reduce the false signals I get from trading indicators, and cut down the frequency of getting stopped out.

It needs some work, though, as you can see in the image (which I didn't post, by the way, but just magically appeared...) There's a lot of lag when it's set at the default of 50 bars averaging, and I think I can improve the method of quantifying the short term volatility. Stay tuned...

Similar threads