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