Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
Overlap Studies
talib.ACCBANDS
talib.BBANDS
talib.DEMA
talib.EMA
talib.HT_TRENDLINE
talib.KAMA
talib.MA
talib.MAMA
talib.MAVP
talib.MIDPOINT
talib.MIDPRICE
talib.SAR
talib.SAREXT
talib.SMA
talib.T3
talib.TEMA
talib.TRIMA
talib.WMA
Momentum Indicators
Volume Indicators
Volatility Indicators
Cycle Indicators
Price Transform
Statistic Functions
Math Transform
Math Operators
Pattern Recognition
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Calculates the Bollinger Bands and returns the upper band, middle band and lower band.

talib.BBANDS(inReal)
talib.BBANDS(inReal, optInTimePeriod)
talib.BBANDS(inReal, optInTimePeriod, optInNbDevUp)
talib.BBANDS(inReal, optInTimePeriod, optInNbDevUp, optInNbDevDn)
talib.BBANDS(inReal, optInTimePeriod, optInNbDevUp, optInNbDevDn, optInMAType)

Examples

Compute the Bollinger Bands from the latest K-lines.

javascript
function main() { var records = exchange.GetRecords() if (!records) return var ret = talib.BBANDS(records) // Output: [upper band array, middle band array, lower band array] Log(ret) }
python
import talib def main(): records = exchange.GetRecords() if not records: return ret = talib.BBANDS(records.Close) # Output: (upper band array, middle band array, lower band array) Log(ret)

Returns

TypeDescription

array

Two-dimensional array: [upper band array, middle band array, lower band array] (a tuple in the same order in Python).

Arguments

NameTypeRequiredDescription

inReal

Record array / numeric array

Yes

K-line array (close prices are used) or numeric array; in Python, pass a numeric array such as records.Close.

optInTimePeriod

number

No

Calculation period. Default 5.

optInNbDevUp

number

No

Standard deviation multiplier for the upper band. Default 2.

optInNbDevDn

number

No

Standard deviation multiplier for the lower band. Default 2.

optInMAType

number

No

Moving average type; see the MAType table on the Talib page. Default 0 (SMA).

See Also

Remarks

TA-Lib equivalent: BBANDS(Records[Close],Time Period = 5,Deviations up = 2,Deviations down = 2,MA Type = 0) = [Array(outRealUpperBand),Array(outRealMiddleBand),Array(outRealLowerBand)].