# Volatility Switch

Plots Ron McEwan's Volatility Switch: the standard deviation of symmetric one-bar price changes, percentile-ranked over its own trailing history so the output is confined to the 0-1 range. Readings above the 0.5 decision line mark elevated volatility that favors mean reversion, readings below it a quiet regime where trends persist, with the published 21-bar defaults for both windows.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jan 26, 2026.
- Access: free.
- Concepts: [Volatility Switch](https://www.luxalgo.com/library/concept/volatility-switch/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=juoqxni9vn61u7x0xxcwotab
- Page: https://www.luxalgo.com/library/indicator/volatility-switch/

**Volatility Switch** distills the volatility regime into one bounded line. Following the published construction of [Ron McEwan's Volatility Switch](https://www.luxalgo.com/library/concept/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](https://www.luxalgo.com/library/indicator/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.

## Related indicators

- [Volatility Contraction Pattern](https://www.luxalgo.com/library/indicator/volatility-contraction-pattern/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/volatility-contraction-pattern.md
- [NR4 & NR7 with Breakouts](https://www.luxalgo.com/library/indicator/nr4-nr7-with-breakouts/) (NR4/NR7 Narrow-range Bars): markdown at https://www.luxalgo.com/library/indicator/nr4-nr7-with-breakouts.md
- [Master Pattern](https://www.luxalgo.com/library/indicator/master-pattern/) (Range Expansion/contraction): markdown at https://www.luxalgo.com/library/indicator/master-pattern.md
- [Waddah Attar Explosion](https://www.luxalgo.com/library/indicator/waddah-attar-explosion/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/waddah-attar-explosion.md
- [Squeeze Index](https://www.luxalgo.com/library/indicator/squeeze-index/) (Range Expansion/contraction): markdown at https://www.luxalgo.com/library/indicator/squeeze-index.md
- [Choppiness Index](https://www.luxalgo.com/library/indicator/choppiness-index/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/choppiness-index.md
- [Damiani Volatmeter](https://www.luxalgo.com/library/indicator/damiani-volatmeter/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/damiani-volatmeter.md
- [Gap-volatility Relation](https://www.luxalgo.com/library/indicator/gap-volatility-relation/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/gap-volatility-relation.md

---

Source: https://www.luxalgo.com/library/indicator/volatility-switch/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
