Volatility Switch
By LuxAlgoJan 26, 2026
Volatility Switch distills the volatility regime into one bounded line. Following the published construction of Ron McEwan's Volatility Switch, it measures the standard deviation of symmetric one-bar relative price changes over 21 bars, then percentile-ranks that estimate within its trailing 21 readings — so the output is confined to the 0-1 range on every symbol. The line prints in the high-volatility color above the dashed 0.5 decision line and the low-volatility color below it, with a gradient fill anchored at 0.5 and dotted bounds at 0 and 1.
How to Trade the Volatility Switch?
- Switch above 0.5: volatility is elevated relative to its own recent history — the choppier regime where mean-reversion tactics have the stronger claim.
- Switch below 0.5: volatility is subdued — the quiet regime that gives trends room to persist.
- Bars in Regime (dashboard): weigh a held side over a single crossing; the reading is a regime label, not a direction call.
Intraday, volatility tracks the session clock, so the rank can rotate with the hour; reading it from a higher timeframe via the Timeframe input is the usual workaround, and those values come from completed bars only, so they do not repaint. Alerts fire on 0.5 crossings in both directions.
Volatility Switch Settings
- Source (default close): the series the one-bar relative changes are measured from.
- Volatility Length (default 21): window of the standard deviation — roughly one month of daily data.
- Rank Length (default 21): trailing history the estimate is ranked against; shorter changes regime faster but flips more often.
- Timeframe (default chart timeframe): computes the switch on a higher timeframe without repainting.
- Show Dashboard (default enabled): regime, switch value, and bars in regime; Regime Background (default disabled) shades the pane by the active regime.
Frequently Asked Questions
How does it differ from Volatility Regime Switches?
Volatility Regime Switches runs a three-state machine with hysteresis and confirmation over a choice of measures. The Volatility Switch is deliberately simpler: one estimate, one rank, one fixed 0.5 line — a lightweight regime read where a state machine would be overhead.
Does the switch tell me which direction to trade?
No. It classifies conditions: above 0.5 argues for fading stretches, below 0.5 for letting trends run. Pair it with a directional tool for entries.
Why do both defaults use 21 bars?
They are the published values, about one trading month on dailies. Lengthening the Rank Length steadies the regime at the cost of slower transitions.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
