Returns the Bollinger Band width: the gap between the upper and lower band divided by the basis.
ta.bbw is (upper - lower) / basis for ta.bb with the same arguments. Dividing by the basis makes the number comparable across price levels.
Low readings mark a squeeze, high readings mark expansion. Early bars, before the average has length values, return na.
Syntax
ta.bbw(series: series int/float, length: series int, mult: simple int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| series | series int/ | required | Series the bands are built on, usually close. |
| length | series int | required | Window length for the average and the deviation. A whole number of 1 or more. |
| mult | simple int/ | required | Number of standard deviations between the basis and each band. |
Returns
series float: the relative band width, or na while the window is not full.
Remarks
- The width equals 2 * mult * stdev / basis.
Example
//@version=6
indicator("Band width")
w = ta.bbw(close, 20, 2)
plot(w, "BBW", color = color.blue)
plot(ta.lowest(w, 100), "100-bar low", color = color.red)See also
Runs on Sidechair