ta.bb
Draw volatility bands around a moving average to spot stretched prices.
ta.bb(source, length, mult)Bollinger Bands: [sma(length), basis + mult*stdev, basis - mult*stdev], population standard deviation.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | The series to read. |
length | Constant | number | 20 | 1 to 10000 | Window in observed bars. |
mult | Constant | number | 2 | 0.001 to 50 | Standard deviations from the basis. |
Outputs
| Name | Type |
|---|---|
middle | number |
upper | number |
lower | number |
The outputs come back in this order: [middle, upper, lower] = ta.bb(…).
Warm-up and missing values
- Warm-up
lengthbars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
lengthconsecutive non-na observations are in the window. An na resets the accumulation.
Example
[basis, upper, lower] = ta.bb(close, 20, 2)[basis, upper, lower] = ta.bb(close, 20, 2)
plot(upper, "Upper")
plot(lower, "Lower")