Volatility Regime Bands TradingView Indicator

Written by Dominic Walsh · Published

One band setting cannot fit every market state. Also, volatility Regime Bands solves that by voting on the regime first, then rebuilding the channel to match. It doubles as a Bollinger Band squeeze indicator TradingView traders can use for breakout timing, because it tracks a Bollinger band sitting inside a Keltner channel and marks the release. Indeed, three readings decide the regime: ADX, Bollinger band width rank and ATR rank.

It is free and open source. Still, you can add it to any chart from the Volatility Regime Bands script page on TradingView, and the full Pine source is published there for you to read.

What Volatility Regime Bands plots on the price chart

Two bands and an optional centre line sit on price. Thus, their colour states the regime: blue for trending, orange for ranging, red for volatile. A soft fill runs between them. Hence, small grey dots mark a squeeze on the centre line, and they turn orange once that squeeze reaches 8 bars. Triangles mark buy and sell signals at the band edge. Diamonds mark a squeeze release. Bars take a regime tint. Next, a ten-row dashboard reports regime, band mode, band width in pips, squeeze state, direction, signal, ADX, volatility rank and the BB to KC ratio.

How Volatility Regime Bands is built

Three votes decide the regime

ADX votes first. Then, the script reads ta.dmi with a length of 14. An ADX above 25 adds two trend votes. Yet, a reading between 18 and 25 adds one. Below 18 it hands a vote to ranging instead.

Bollinger band width votes second. Truly, the script ranks the current 20-period band width against its own last 100 bars. A rank above 75 adds one volatile vote and one trend vote together. Plainly, a rank under 25 adds two ranging votes. ATR rank votes third on the same 100-bar percentile basis. Also, above 75 it adds two volatile votes. Under 25 it adds one ranging vote.

The tally then classifies. Indeed, three volatile votes force the VOLATILE state, and only two sources supply them, so band width and ATR must both sit in their top quartile at once. Otherwise more trend votes than ranging votes gives TRENDING, and anything else gives RANGING. Still, that makes VOLATILE a deliberately rare label rather than a default.

Bands blend by state, signals switch with it

The centre is a 20-period EMA. Thus, two width components feed the bands. One is ATR over 20 times 1.5, which behaves like a Keltner channel. Hence, the other is the 20-period standard deviation times 2.0, which behaves like Bollinger. The regime sets the blend. Trending uses 80 percent ATR. Ranging uses only 20 percent ATR and leans on standard deviation. Volatile splits the two evenly.

An expansion factor follows: 1.2 in trending, 0.9 in ranging and 1.5 in volatile. Next, the result runs through an 8-period EMA so the channel does not jump between states. Squeeze detection runs alongside, comparing a standard 20 and 2.0 Bollinger against a 20 and 1.5 Keltner. Then, when the Bollinger sits inside, the squeeze is on.

Signal logic switches with the regime too. In trending, a confirmed close crossing the upper band prints a buy and a cross under the lower band prints a sell. In ranging, the logic inverts and fades the edges instead. Yet, in volatile, the script prints nothing at all. A squeeze release adds its own signal, and a 12-period linear regression slope picks its side.

How to read the signals

Read the Band Mode row before you read the bands. Truly, TREND-FOLLOW means a break of the upper band counts as continuation. MEAN-REVERT means the same touch counts as a fade. Plainly, those two readings ask for opposite trades, so the row matters more than the shape on screen.

Use the squeeze rows for timing. Also, the dashboard shows ACTIVE with a bar count, then TIGHT once that count reaches 8. A BB to KC ratio under 1.00 confirms the compression numerically. Indeed, the diamond marks the release, and the linear regression slope picks its direction.

Treat a red VOLATILE state as a stand-aside label. Still, the script suppresses every regime signal there and widens the bands by half again. That is a design choice, not a fault. Thus, if you still want to trade those conditions, bring your own rules, because this tool deliberately goes quiet.

Every Volatility Regime Bands setting explained

The script exposes 19 inputs, grouped in the settings panel exactly as shown below. Defaults are the published values.

Regime Detection

SettingWhat it doesDefaultRange
ADX LengthPeriod for ADX trend strength measurement145 to 50
ADX Trend ThresholdADX above this = trending market2515 to 40
ADX Weak ThresholdADX above this but below trend = weak trend (still counts)1810 to 30
Regime SmoothingEMA smoothing for band width transitions between regimes81 to 20

Band Settings

SettingWhat it doesDefaultRange
Band LengthPeriod for center EMA and band calculations205 to 100
ATR MultiplierATR multiplier for Keltner-style component (trend-following)1.50.5 to 4.0
StdDev MultiplierStandard deviation multiplier for Bollinger-style component (mean-reversion)2.00.5 to 4.0
Show Center LineToggles show center line on the chart.onon / off

Signals

SettingWhat it doesDefaultRange
Enable Trade SignalsShow regime-adaptive buy/sell signals on chartonon / off
Enable Squeeze DetectionDetect BB inside KC squeeze for breakout timingonon / off
Show Bar ColorsColor bars by regime stateonon / off

Display

SettingWhat it doesDefaultRange
Show DashboardToggles show dashboard on the chart.onon / off
Show Band FillFill area between upper and lower bandsonon / off
Show Regime BackgroundTint chart background by regimeoffon / off
Table PositionChoose the table position from the listed options.top_righttop_left, top_center, top_right, bottom_left, bottom_center, bottom_right
Text SizeChoose the text size from the listed options.smalltiny, small, normal

Colors

SettingWhat it doesDefaultRange
TrendingBand color in trending regime#2196F3
RangingBand color in ranging regime#FF9800
VolatileBand color in volatile regime#EF5350

Alerts built into Volatility Regime Bands

The script ships 6 alert conditions. Hence, open the alert dialog on the chart, pick the indicator as the condition source, then choose the event you want. Alerts fire on the close of the bar, so they follow the same confirmed-bar rule the on-chart signals use.

  • Regime → Trending
  • Regime → Volatile
  • Bullish Signal
  • Bearish Signal
  • Squeeze Fired
  • Price Outside Bands

Other markets and timeframes

Nothing in the regime logic uses an absolute price level. Next, ADX, percentile ranks and standard deviation all self-normalise, so the same 25 and 18 ADX thresholds work on indices, metals and crypto. The script also ignores volume entirely, which keeps it safe on symbols with a thin or missing volume feed. Then, one display detail is forex specific. Band width shows in pips by dividing by mintick and then by ten, so on other instruments read that row as a relative number only.

Limitations worth knowing

The tool classifies conditions and draws a channel. Yet, it carries no stop, no target and no sizing. It also refuses to signal in the volatile regime, so the loudest sessions of the week can pass without a single mark on the chart.

Regime detection lags by construction. Truly, both percentile ranks look back 100 bars, ADX smooths twice, and band width passes through an 8-period EMA. So a fresh state change shows up several bars after the market already turned. Plainly, read the labels as a description of recent conditions, not the next ones.

Only the triangles gate on barstate.isconfirmed. Also, the bands, the squeeze dots and the squeeze release diamonds all update on the forming bar, so a diamond can appear and then disappear before the candle closes. Judge a release on the closed bar.

Get Volatility Regime Bands on TradingView

Open Volatility Regime Bands on TradingView

If you also trade MetaTrader, the MT4 and MT5 indicator library is available below.

Get the complete indicator library

One email unlocks the full MT4 and MT5 indicator library. Indeed, this TradingView script stays free on TradingView – the button above adds it to your chart.

Using it alongside MetaTrader

Adding a script on TradingView takes one click, so there is no install step here. Still, if you want the same idea on MetaTrader, the MT4 and MT5 indicator installation guide walks through copying files into the data folder and attaching them to a chart. You can also browse the full MetaTrader indicator library, the MT4 indicators section, or the other free TradingView scripts published on this profile. For related chart tools see the MT5 indicators section and the forex trading strategies guides.

External references

Frequently asked questions

Do the signals repaint?

The buy and sell triangles do not. Thus, both signal variables require barstate.isconfirmed, so they print only once the bar closes. The squeeze release diamonds differ. Hence, they read the raw fired variable, so they can flash on a live bar and then vanish. Wait for the close on those.

What exactly triggers the VOLATILE regime?

It needs three volatile votes, and only two sources supply them. Next, Bollinger band width rank must sit above 75 and ATR rank must sit above 75 at the same time. Both ranks measure the last 100 bars. Then, anything less leaves the script in trending or ranging.

How does this differ from standard Bollinger Bands?

Standard bands use one formula all the time. Yet, this one blends a Keltner style ATR component with a Bollinger style standard deviation component, then changes the mix by regime: 80 percent ATR in trending, 20 percent in ranging. It scales the whole width by an expansion factor and smooths the result.

Does it need volume data?

No. The script never reads volume. ADX, ATR, standard deviation and linear regression all work from price alone, so it behaves the same on spot forex, on indices and on any symbol with a thin volume feed.

How much should I rely on this indicator?

Treat it as one input, not a decision. Truly, it is a chart analysis tool, not trading advice. Test it on your own markets and timeframes before relying on it. Results are not guaranteed; past performance is not indicative of future results.

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment