Volatility Regime Compass [JOAT]Volatility Regime Compass
Introduction
Volatility Regime Compass is an open-source volatility state classifier that continuously measures where current ATR stands relative to its own historical distribution and maps it to one of four named regimes: Compressed, Normal, Elevated, and Extreme. The classification is not binary (high or low) — it uses a rolling percentile ranking against configurable lookback windows so the regime reflects where current volatility stands within its recent history, not against a fixed absolute threshold that becomes stale as market conditions evolve.
The practical value is in strategy switching: mean-reversion techniques tend to work in compressed regimes, breakout and momentum techniques in elevated ones. Knowing which regime is active before selecting a technique reduces category errors that produce losses.
Core Concepts
1. ATR Percentile Ranking
Rather than comparing ATR to a static multiplier, the indicator ranks the current ATR value within a rolling distribution of historical ATR values. This produces a percentile score from 0 to 100 that is self-normalizing across different instruments and timeframes:
float atrHi = ta.highest(atrVal, i_rankLen)
float atrLo = ta.lowest (atrVal, i_rankLen)
float atrPct = (atrHi - atrLo) > 0 ?
(atrVal - atrLo) / (atrHi - atrLo) * 100.0 : 50.0
A reading of 80 means current ATR is in the 80th percentile of its recent range — clearly elevated. A reading of 15 means ATR is near multi-period lows — compressed.
2. Four-State Regime Classification
The percentile score maps to four regimes with configurable boundary thresholds. Defaults are: Compressed (below 25th percentile), Normal (25th to 60th), Elevated (60th to 85th), Extreme (above 85th). Crossing a regime boundary triggers a transition event labeled on the chart.
3. Multi-Band Visualization
Five ATR bands project above and below close at configurable multiples (0.5×, 1×, 1.5×, 2×, 2.5× ATR). Each band is color-coded by regime — tighter bands in compressed regimes shade cooler, wider bands in extreme regimes shade hotter using a 5-stop gradient. This gives instant visual calibration of price's relationship to current volatility structure.
4. Volatility Trend
The rate of change of ATR is computed and smoothed. Positive volatility trend (ATR rising) is labeled differently from negative trend (ATR contracting). This distinguishes a currently-elevated but contracting regime from one that is expanding — the former is more likely to produce consolidation, the latter continuation.
Features
ATR percentile ranking: Self-normalizing volatility score relative to recent history
Four volatility regimes: Compressed, Normal, Elevated, Extreme with configurable boundaries
Regime transition labels: On-chart labels at every regime change event
Five ATR expansion bands: Projected above and below close, gradient-colored by regime
Volatility trend direction: Rising vs contracting ATR tracked independently of level
Candle coloring: Candles reflect current volatility regime in real time
Regime background shading: Chart background tint corresponds to current regime
Dashboard: Current ATR, percentile, regime, trend direction, and band levels
Input Parameters
ATR Settings:
ATR Period: ATR calculation length (default: 14)
Percentile Lookback: Rolling window for ATR percentile ranking (default: 100)
Regime Thresholds:
Compressed Below: Percentile below which regime is Compressed (default: 25)
Elevated Above: Percentile above which regime is Elevated (default: 60)
Extreme Above: Percentile above which regime is Extreme (default: 85)
How to Use This Indicator
Step 1: Check the Current Regime
Read the REGIME row in the dashboard. This tells you whether to expect range-bound or trending behavior in the near term.
Step 2: Watch for Regime Transitions
A transition from Compressed to Elevated is the setup for breakout strategies. A transition from Extreme back toward Normal may signal trend exhaustion.
Step 3: Use Bands as Structural Reference
The ATR bands define statistically reasonable price excursion limits for the current volatility state. Closes beyond the 2× or 2.5× band while in a Compressed regime are structurally significant events.
Step 4: Combine with Directional Indicators
This indicator classifies volatility magnitude, not direction. Pair it with a trend or momentum tool to apply regime context to directional decisions.
Indicator Limitations
Percentile ranking depends on lookback length; very short lookbacks can produce unstable regime classifications during sudden volatility spikes
The four-state classification is a simplification; volatility is continuous and regime boundaries are heuristic
Volatility expansion does not indicate direction — it only measures magnitude of movement
Originality Statement
The combination of a self-normalizing ATR percentile ranking, a four-state regime classifier with configurable percentile boundaries, gradient-coded multi-band projection, and a simultaneous volatility trend tracker in a single Pine Script v6 publication constitutes the original contribution. Standard ATR indicators display the raw value or a fixed-multiple band without regime classification or percentile normalization.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Volatility regime classifications are statistical summaries of historical data and do not predict future price movement. Trading involves substantial risk of loss.
-Made with passion by jackofalltrades
Индикатор Pine Script®






















