VolatilityPine Script v6

ta.bbw()Bollinger Bands Width

The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band.

TradingView language reference

Syntax

Syntax
ta.bbw(series, length, mult) → series float

Arguments

ParameterTypeDescription
seriesseries int/floatSource series (typically price).
lengthseries intLength of the moving average and standard deviation window.
multsimple int/floatStandard deviation factor.

Returns

Bollinger Bands Width.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.bbw")
plot(ta.bbw(close, 20, 2), title="Built-in BBW", color=color.yellow)

Trading Applications

Detect Bollinger Band squeezes for breakout anticipation

Measure relative volatility over time

Identify low-volatility consolidation periods

Trigger alerts when bandwidth reaches extreme levels

Related Functions

Frequently Asked Questions

ta.bbw() measures band width relative to the middle band. When comparing it with a hand-written calculation or another indicator, verify whether each output uses a ratio or a percentage before reusing thresholds. Narrow width indicates low volatility (squeeze); expanding width indicates rising volatility.

Compare BBW to its own recent history: unusually low BBW suggests the bands are tight and volatility may be about to expand. Many traders wait for a price breakout direction before acting.

There is no universal threshold; squeeze is relative to the symbol and timeframe. Use percentile ranks, historical lows on BBW, or visual inspection versus past consolidation phases.

Generate ta.bbw() Code with AI

Draft Pine Script using ta.bbw() with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.