The talib.VAR()
function is used to calculate Variance.
The return value of the talib.VAR()
function is: a one-dimensional array.
array
talib.VAR(inReal) talib.VAR(inReal, optInTimePeriod) talib.VAR(inReal, optInTimePeriod, optInNbDev)
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 optInNbDev
parameter is used to set the Deviations, the default value is 1.
optInNbDev
false
number
function main() {
var records = exchange.GetRecords()
var ret = talib.VAR(records)
Log(ret)
}
import talib
def main():
records = exchange.GetRecords()
ret = talib.VAR(records.Close)
Log(ret)
void main() {
auto records = exchange.GetRecords();
auto ret = talib.VAR(records);
Log(ret);
}
The VAR()
function is described in the talib library documentation as: VAR(Records[Close],Time Period = 5,Deviations = 1) = Array(outReal)