Skip to content
Algo Trade Analytics Docs

ta.bb() - Pine Script Function

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.

ta.bb(series, length, mult) → [series float, series float, series float]
NameTypeDescription
seriesseries int/floatSeries of values to process.

Bollinger Bands.

  • na values in the source series are ignored; the function calculates on the length quantity of non-na values.
//@version=6
indicator("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)