Volatility regime
Ranks current average true range against recent bars: 1 is the quietest fifth, 5 the loudest.
VolatilityRegime takes a simple average of each bar's true range over the last atr_window bars. A true range is the bar's high-low range, widened to include any gap from the prior close, and the first bar in the window has no prior close, so the average uses one fewer true range than bars. It then ranks that average against the last lookback averages: 1 when fewer than 20% of them sit below the current one, 5 when at least 80% do. The result is a rank of recent volatility, not an absolute measure of how wild the market is.
How to read it
- Drawn in its own pane below the price, as whole steps from 1 to 5.
- 1 and 2 mean the current range sits in the quietest 40% of recent readings; 4 and 5 mean the loudest 40%.
- The scale always spreads out because it ranks against recent bars: a 5 is loud against the last few hours, not against the day or the year.
- On a month of SPY one-minute bars the output covered all five steps, with 3 as the median.
What it outputs
- Volatility regime (1-5)
- Whole-number volatility rank from 1 (quietest 20% of recent readings) to 5 (loudest 20%). Shows 3 while history builds.
Settings
- atr_window
- Bars in the average true range. Raising it smooths the reading and reacts later to range bursts; lowering it reacts within a few bars and flips between buckets more on noise. Below 2 the indicator produces no values.
- lookback
- How many recent averages the current one is ranked against. Raising it judges volatility over a longer stretch and changes buckets more slowly; lowering it shortens that memory. Below 50 the output is stuck at 3 forever.
Pitfalls
- Settings below the stated minimums fail silently: atr_window under 2 never produces a value, and lookback under 50 pins the output at 3.
- With default settings the first 13 bars show nothing and the next 49 show a placeholder 3, so the opening hour of a chart is not a real reading.
- It measures range, not direction. On SPY one-minute bars its correlation with price is about zero (-0.03), so a high reading says nothing about which way price will move.