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

talib.MACD

The talib.MACD() function is used to calculate Moving Average Convergence/Divergence (exponentially smoothed moving average).

The return value of the talib.MACD() function is: a two-dimensional array. array

talib.MACD(inReal) talib.MACD(inReal, optInFastPeriod) talib.MACD(inReal, optInFastPeriod, optInSlowPeriod) talib.MACD(inReal, optInFastPeriod, optInSlowPeriod, optInSignalPeriod)

The inReal parameter is used to specify the K-line data. inReal true {@struct/Record Record} structure arrays, numeric arrays The optInFastPeriod parameter is used to set the fast period, the default value is 12. optInFastPeriod false number The optInSlowPeriod parameter is used to set the slow period, the default value is 26. optInSlowPeriod false number The optInSignalPeriod parameter is used to set the signal period, the default value is 9. optInSignalPeriod false number

function main() {
    var records = exchange.GetRecords()
    var ret = talib.MACD(records)
    Log(ret)
}
import talib
def main():
    records = exchange.GetRecords()
    ret = talib.MACD(records.Close)
    Log(ret)
void main() {
    auto records = exchange.GetRecords();
    auto ret = talib.MACD(records);
    Log(ret);
}

The MACD() function is described in the talib library documentation as: MACD(Records[Close],Fast Period = 12,Slow Period = 26,Signal Period = 9) = [Array(outMACD),Array(outMACDSignal),Array(outMACDHist)]

talib.DX talib.MACDEXT