OPEN-SOURCE SCRIPT

Relative ATR Volatility Indicator

1 622
This relative volatility regime indicator measures whether current volatility is high, low, or "normal" compared to its own recent historical range.

It calculates ATR, then compares the current ATR reading against a rolling percentile window. By default, it looks back over the last 100 bars and marks:

  • The upper volatility threshold, based on the 80th percentile of recent ATR readings (red)
  • The lower volatility threshold, based on the 20th percentile of recent ATR readings (green)


With the default settings of a 100-bar Rolling Window Length, Top Percentile of 80, and Bottom Percentile of 20:

If the white ATR line is above the red line, current volatility is in the highest 20% of recent ATR readings.

If the white ATR line is below the green line, current volatility is in the lowest 20% of recent ATR readings.

In other words, the script ranks current ATR against its own recent history and highlights volatility extremes. This makes it easier to objectively identify whether a market is currently in a high-volatility, low-volatility, or normal-volatility regime.

The indicator is directionally agnostic. A high ATR reading does not mean price is bullish or bearish; it simply means the market is moving more than usual. High ATR can occur during bullish expansion, bearish selloffs, large gaps, or choppy high-range conditions.

The main values are:

  • White line = current ATR value
  • Red line = upper ATR percentile threshold
  • Green line = lower ATR percentile threshold
  • Grey line = middle 50th percentile (turned off in Style Settings by default)
  • ATR Ratio Upper = current ATR divided by the upper threshold
  • ATR Ratio Lower = current ATR divided by the lower threshold


The ATR Ratio values can be used as an input by other scripts or strategies:

  • ATR Ratio Upper above 1 means ATR is above the upper volatility threshold
  • ATR Ratio Lower below 1 means ATR is below the lower volatility threshold


This script uses Pine Script's ta.percentile_nearest_rank() function to calculate rolling ATR percentile thresholds.

This is a lagging indicator, like most indicators, but it provides a useful way to classify volatility regimes objectively.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.