Bollinger BandWidth (BBW)
Summary
Bollinger BandWidth: the distance between the upper and lower Bollinger Bands as a percentage of the middle band. Low values mark contracting volatility, the setup John Bollinger calls the Squeeze; high values mark expanding volatility.
Formula
where , and are the BBANDS bands of with period , moving-average type and deviation multipliers , . Since both bands sit on the middle band, , with the population standard deviation of the last values of .
Notes
- With Bollinger's settings (a simple moving average and two deviations on each side) BBW is 400 times the window's coefficient of variation: its standard deviation divided by its mean.
- The two deviation multipliers enter only through their sum.
- The result is in percent: 10 means the bands are 10% of the middle band apart.
- Any
optInMATypeother than SMA is a TA-Lib generalisation, as it is for BBANDS: the deviation stays the population standard deviation about the simple mean. - Wherever the middle band is not 0, BBW is bit for bit
((upper - lower) / middle) * 100computed from BBANDS' own outputs.
Inputs
inReal— Input data series
Outputs
outReal— Width of the bands as a percentage of the middle band
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 20 | 2–100000 | Periods for the MA and standard deviation |
optInNbDevUp | real | 2 | any real | Standard-deviation multiplier for the upper band |
optInNbDevDn | real | 2 | any real | Standard-deviation multiplier for the lower band |
optInMAType | MAType | SMA (0) | any MAType | Moving-average type for the middle band |
MAType values: 0 SMA · 1 EMA · 2 WMA · 3 DEMA · 4 TEMA · 5 TRIMA · 6 KAMA · 7 MAMA · 8 T3 · 9 HMA · 10 DISABLED · 11 DEFAULT · 12 ZLEMA · 13 RMA · 14 VIDYA · 15 ALMA
Properties
Numerical Stability: Depends on MA Type — This function's default, SMA, is start-independent.
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: bbw.c · bbw.yaml
| Native | File |
|---|---|
| C | ta_BBW.c |
| Rust | bbw.rs |
| Java | Core_BBW.java |
| C# | Core_BBW.cs |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Bollinger BandWidth, Bollinger Band Width, Bollinger Bands Width, BandWidth
See Also
BBANDS · PERCENTB · STDDEV · NATR
References
- John A. Bollinger, Bollinger on Bollinger Bands, McGraw-Hill 2001 (ISBN 0071373683)
- John Bollinger, Bollinger Band Rules, rule 18