talib.bb

Bollinger bands for source over length bars, with mult setting how far the outer bands sit from the middle one. Note the type of mult: it is an int in this signature, so a fractional multiplier is not accepted.

talib.bb(series float source, series int length, series int mult) → [series float, series float, series float]
ParameterTypeRequiredDescription
sourceseries floatyesThe series the bands are built on.
lengthseries intyesHow many bars the calculation covers.
multseries intyesBand multiplier. An int, not a float: a fractional multiplier is refused when the script is checked, and there is no rounding.

Returns [series float, series float, series float] — Three series float values as a tuple, in the order middle, upper, lower. The basis comes first, not the upper band.

indicator("Bollinger bands")
[middle, upper, lower] = talib.bb(close, 20, 2)
plot(middle, title = "Middle")
plot(upper, title = "Upper")
plot(lower, title = "Lower")

See also talib.alma · talib.atr · talib.barssince

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade