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:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
310 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.