The talib.BBANDS()
function is used to calculate Bollinger Bands.
The return value of the talib.BBANDS()
function is: a two-dimensional array. The array contains three elements which are: the upper line array, the middle line array, and the lower line array.
array
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)
The inReal
parameter is used to specify the K-line data.
inReal
true
{@struct/Record Record} structure arrays, numeric arrays
The optInTimePeriod
parameter is used to set the period, the default value is 5.
optInTimePeriod
false
number
The optInNbDevUp
parameter is used to set the upline multiplier, the default value is 2.
optInNbDevUp
false
number
The optInNbDevDn
parameter is used to set the lower line multiplier, the default value is 2.
optInNbDevDn
false
number
The optInMAType
parameter is used to set the mean type, the default value is 0.
optInMAType
false
number
function main() {
var records = exchange.GetRecords()
var ret = talib.BBANDS(records)
Log(ret)
}
import talib
def main():
records = exchange.GetRecords()
ret = talib.BBANDS(records.Close)
Log(ret)
void main() {
auto records = exchange.GetRecords();
auto ret = talib.BBANDS(records);
Log(ret);
}
The BBANDS()
function is described in the talib library documentation as: BBANDS(Records[Close],Time Period = 5,Deviations up = 2,Deviations down = 2,MA Type = 0) = [Array(outRealUpperBand),Array(outRealMiddleBand),Array(outRealLowerBand)]