Lipi Reference Lipi

Functions

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.

Syntax

                talib.bb(series float source, series int length, series int mult) → [series float, series float, series float]
              

Arguments

source required series float The series the bands are built on.
length required series int How many bars the calculation covers.
mult required series int Band multiplier. An int, not a float: a fractional multiplier is refused when the script is checked, and there is no rounding.

Return Type

[series float, series float, series float]

Example


          indicator("Bollinger Bands", overlay=true)
// User inputs
length = input.int(20, title="BB Length")
mult = input.int(2, title="BB Multiplier")
// Calculate Bollinger Bands
[bbMiddle, bbUpper, bbLower] = talib.bb(close, length, mult)
// Plot the bands
plot(bbMiddle, title="BB Middle", color=color.blue)
plot(bbUpper, title="BB Upper", color=color.green)
plot(bbLower, title="BB Lower", color=color.red)