ta.bb() - Pine Script Function
ta.bb()
Section titled “ta.bb()”Overview
Section titled “Overview”Bollinger Bands. A Bollinger Band is a technical analysis tool defined by a set of lines plotted two standard deviations (positively and negatively) away from a simple moving average (SMA) of the security’s price, but can be adjusted to user preferences.
Syntax
Section titled “Syntax”ta.bb(series, length, mult) → [series float, series float, series float]Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| series | series int/float | Series of values to process. |
Returns
Section titled “Returns”Bollinger Bands.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("ta.bb")[middle, upper, lower] = ta.bb(close, 5, 4)plot(middle, color=color.yellow)plot(upper, color=color.yellow)plot(lower, color=color.yellow)// the same on pinef_bb(src, length, mult) => float basis = ta.sma(src, length)float dev = mult * ta.stdev(src, length) [basis, basis + dev, basis - dev][pineMiddle, pineUpper, pineLower] = f_bb(close, 5, 4)plot(pineMiddle)plot(pineUpper)plot(pineLower)