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.
Syntax
ta.bbw(series, length, mult) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| series | series int/float | Source series (typically price). |
| length | series int | Length of the moving average and standard deviation window. |
| mult | simple int/float | Standard deviation factor. |
Returns
Bollinger Bands Width.
Remarks
na values in the source series are ignored.
Code Examples
//@version=6
indicator("ta.bbw")
plot(ta.bbw(close, 5, 4), color=color.yellow)
// the same on pine
f_bbw(src, length, mult) =>
float basis = ta.sma(src, length)
float dev = mult * ta.stdev(src, length)
(((basis + dev) - (basis - dev)) / basis) * 100
plot(f_bbw(close, 5, 4))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
Frequently Asked Questions
Generate ta.bbw() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.bbw() and other built-in functions instantly.
Related Pine Script Functions
ta.bb() - Bollinger Bands
Learn how to use ta.bb() in Pine Script. Syntax, parameters, code examples for Bollinger Bands with upper, middle, and lower bands.
ta.kcw() - Keltner Channels Width
Learn how to use ta.kcw() in Pine Script. Syntax, parameters, code examples for Keltner Channel Width measurement.
ta.stdev() - Standard Deviation
Learn how to use ta.stdev() in Pine Script. Syntax, parameters, code examples for statistical standard deviation calculation.
ta.atr() - Average True Range
Learn how to use ta.atr() in Pine Script. Syntax, parameters, code examples for the Average True Range volatility indicator.
ta.kc() - Keltner Channels
Learn how to use ta.kc() in Pine Script. Syntax, parameters, code examples for Keltner Channel volatility bands.