资源加载中... loading...

TA指标库

发明者量化的TA指标库优化了常用指标算法,支持JavaScriptPythonC++语言的策略调用。 开源TA库代码发明者量化交易平台API手册

function main(){
    // records的长度,当数据长度不足指标函数的参数计算要求时将返回无效值
    var records = exchange.GetRecords()
    var macd = TA.MACD(records)
    var atr = TA.ATR(records, 14)
    
    // 打印出最后一组指标值
    Log(macd[0][records.length-1], macd[1][records.length-1], macd[2][records.length-1])
    Log(atr[atr.length-1])
}
def main():
    r = exchange.GetRecords()
    macd = TA.MACD(r)
    atr = TA.ATR(r, 14)
    Log(macd[0][-1], macd[1][-1], macd[2][-1])
    Log(atr[-1])
void main() {
    auto r = exchange.GetRecords();
    auto macd = TA.MACD(r);
    auto atr = TA.ATR(r, 14);
    Log(macd[0][macd[0].size() - 1], macd[1][macd[1].size() - 1], macd[2][macd[2].size() - 1]);
    Log(atr[atr.size() - 1]);
}
Web3 talib指标库