Volatility Trail [EXCAVO]ATR Percentile Rank Painted as a Semi-Transparent Wave Beneath Every Candle
The Volatility Trail takes the four-state volatility regime classification
from the standard ATR-percentile model and renders it directly on the price
chart as a semi-transparent wave hanging under each candle. The wave reads at
a glance: blue under the candles means quiet markets, orange means heating up,
red means volatility extremes. No separate indicator pane is required.
This is not a basic ATR oscillator. The ATR is normalised against its own
historical distribution, smoothed, and classified into four bounded regimes
(Low / Normal / Elevated / Extreme) with adjustable thresholds. The on-chart
trail is the same engine as the standard Volatility Percentile indicator,
just drawn where you actually read price.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW TO USE
Step 1 → Add the indicator. A coloured wave appears beneath every
candle as soon as enough history is available for the percentile
lookback to be meaningful (default 200 bars).
Step 2 → Read the wave colour:
- Blue = Low volatility (compression, mean-reversion regime)
- Grey = Normal volatility
- Orange = Elevated volatility (trend regime)
- Red = Extreme volatility (top decile, exhaustion risk)
Step 3 → Watch transitions. A switch from blue to orange flags a
breakout out of compression. A switch from red back to orange
flags a release from extreme volatility - often the right side
of a spike. The floating state badge to the right of the last
candle shows the current regime name at a glance.
Step 4 → Check the dashboard. State, raw percentile, ATR, ATR / Price,
and Vol Trend show the current regime numerically. Use these to
size positions and pick filters that depend on volatility.
Step 5 → Combine with structure. The trail is a context tool, not a
directional one - it tells you HOW volatile the market is, not
WHICH way it will move. Pair it with your own setup criteria.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW IT CALCULATES
◆ ATR Percentile Rank
The base measure is Average True Range over the user-set length (default 14).
For every bar the current ATR is ranked against its own values over the
Lookback Period (default 200): percentile = 100 x rank / N. A value of 90
means current volatility is higher than 90 percent of bars in the lookback
window. This normalisation makes the reading comparable across instruments
and timeframes - 90th-percentile vol on BTC and on EURUSD are both rare even
though their absolute ATRs differ by orders of magnitude.
◆ Smoothing
The raw percentile is smoothed with a short SMA (default 3) to reduce single-
bar noise. Smoothing = 1 disables this step.
◆ Four-State Classification
The smoothed percentile is bucketed into four regimes:
- Low = below Low / Normal boundary (default 25)
- Normal = between Low / Normal and Normal / Elevated (default 25 to 60)
- Elevated = between Normal / Elevated and Elevated / Extreme (default 60 to 80)
- Extreme = at or above Elevated / Extreme (default 80)
All three boundaries are user-adjustable.
◆ Candle-Anchored Downward Wave
A semi-transparent band hangs directly under each candle. The upper edge
is the bar's low, lightly EMA-smoothed so single-bar wick spikes do not
poke through the ribbon. The lower edge drops below by an ATR-scaled
distance: drop = ATR x (1 + percentile x Wave Distance Scale). At calm
regimes the wave is a thin sliver under price; at volatile extremes it
extends well below. The colour is the active state colour, and the
opacity within each state band is gradient (see next item).
◆ Within-Band Opacity Gradient
The wave colour is the state colour (blue / grey / orange / red), but the
opacity is not flat across each state - it ramps from Min Opacity at the
LOWER edge of the band (regime just entered) to Max Opacity at the UPPER
edge (peak of the regime, about to graduate to the next state). So a fresh
red band that just crossed into Extreme is light red, while a red band at
percentile 95 is a deep saturated red. The same gradient applies inside
the Low / Normal / Elevated bands. This lets you read at a glance whether
the current regime is just beginning, peaking, or about to fade into the
next state - approach and exhaustion are separately readable inside every
band.
◆ Vol Trend
ATR is compared to its 20-bar SMA. Above 1.05x SMA = RISING, below 0.95x =
FALLING, else STABLE. Shown on the dashboard as a quick second-derivative
read of the regime.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ WHAT MAKES IT DIFFERENT
◆ Wave Lives On The Price Chart
Most volatility indicators occupy a separate pane and force the eye to jump
between price action and the oscillator. The wave overlays the same regime
information directly on the candles, so price and volatility are read
together in one view.
◆ Adaptive Across Instruments
Percentile-rank normalisation removes the absolute ATR units. A BTC chart
and a EURUSD chart use the same scale (0 to 100), so the same thresholds
work everywhere without manual tuning.
◆ Four Bounded Regimes Instead Of A Raw Line
A raw ATR plot tells you very little until you have a feel for what is
"normal" on that instrument. The four-state classification answers the
question directly - quiet, normal, elevated, or extreme - using
user-adjustable boundaries.
◆ Within-Band Opacity Gradient
Inside each state band the wave opacity ramps from light (just-entered
regime) to saturated (regime at its peak). A fresh red band reads as
pale red; a deep mature Extreme reads as a saturated red. Approach and
exhaustion are separately readable inside every regime, not just on
state transitions.
◆ Premium Visual Polish
A thin rim-light line follows the upper edge of the wave for definition,
and a contrast-aware state badge floats next to the last candle showing
the current regime name. The badge text colour is picked automatically
by the perceived luminance of the background so the label stays readable
on any state colour.
◆ Optional Bar Coloring And Background
For users who want the regime even more visible, bar-coloring and
background-highlight toggles tint the candles or the chart background with
the active state colour. Both default off so the wave stays as the primary
visual.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ DASHBOARD
Real-time panel (top right) with the current regime readout:
State - LOW / NORMAL / ELEVATED / EXTREME
Percentile - the smoothed ATR percentile (0 to 100)
ATR - raw Average True Range
ATR / Price - ATR as a percentage of close (instrument-independent)
Vol Trend - RISING / STABLE / FALLING based on ATR vs its 20-bar SMA
Lookback - the bar count used for the percentile rank
Legend table (bottom left) explains every colour. Both panels toggle in the
Dashboard settings.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ SETTINGS
Engine
ATR Length - 14 (period for the Average True Range)
Lookback Period - 200 (historical bars used for the percentile rank)
Smoothing - 3 (SMA length applied to the raw percentile; 1 disables it)
State Thresholds
Low / Normal - 25 (boundary between Low and Normal regimes)
Normal / Elevated - 60 (boundary between Normal and Elevated)
Elevated / Extreme - 80 (boundary between Elevated and Extreme)
Visualization
Low Vol Color - blue
Extreme Vol Color - red
Elevated Vol Color - orange
Wave Top Smoothing - 3 (EMA length applied to the wave top; 1 = raw bar low with sharp peaks, 3 to 5 rounds off single-bar spikes while staying tight to price)
Wave Distance Scale - 0.025 (controls how far the wave drops below each candle as volatility rises; drop = ATR x (1 + percentile x scale); default keeps drops modest - approximately 1 ATR at Low regime, 3.5 ATR at Extreme)
Min Opacity - 25 (wave opacity at the LOWER edge of every state band - just-entered regime; very transparent)
Max Opacity - 55 (wave opacity at the UPPER edge of every state band - peak of the regime; visible but kept semi-transparent so the candles stay readable)
Wave Top Highlight - ON (thin rim-light line along the upper edge of the wave; adds definition and a premium glow)
Right-edge State Label - ON (floating badge next to the last candle showing the current state name in the state color)
Bar Coloring - OFF (when ON, also tints the candles with the state color)
Background Highlight - OFF (when ON, tints the chart background)
Dashboard
Show Dashboard - ON
Dashboard Position - Top Right
Show Legend - ON
Alerts
JSON Alerts - OFF (when ON, emits a structured JSON payload via alert())
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ ALERTS
Extreme Volatility - state just transitioned into Extreme
Elevated Volatility - state just transitioned into Elevated
Normal Volatility - state just transitioned into Normal
Low Volatility - state just transitioned into Low
With JSON Alerts ON, the alert() call emits a structured payload with
ticker, state, percentile, atr_pct, price, timeframe, and indicator fields -
use "Any alert() function call" as the TradingView alert event to receive
every state change as JSON on one alert.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Best regards,
EXCAVO
Disclaimer
Trading involves significant risk. This indicator is a technical analysis tool
and does not constitute financial advice, investment recommendations, or a
guarantee of future results. Past indicator behavior does not guarantee future
performance. Always use proper risk management and your own judgment.
Indicador Pine Script®






















