Docs

ta.bb

Draw volatility bands around a moving average to spot stretched prices.

itm
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.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to read.
lengthConstantnumber201 to 10000Window in observed bars.
multConstantnumber20.001 to 50Standard deviations from the basis.

Outputs

NameType
middlenumber
uppernumber
lowernumber

The outputs come back in this order: [middle, upper, lower] = ta.bb(…).

Warm-up and missing values

Warm-up
length bars. Names in the warm-up are this operator’s parameters.
Missing values
Returns na until length consecutive non-na observations are in the window. An na resets the accumulation.

Example

itm
[basis, upper, lower] = ta.bb(close, 20, 2)
itm
[basis, upper, lower] = ta.bb(close, 20, 2)
plot(upper, "Upper")
plot(lower, "Lower")