The TA.MACD()
function is used to calculate the exponential smoothed dissimilarity and similarity MACD indicator.
The return value of the TA.MACD()
function is a two-dimensional array with the structure: [DIF, DEA, MACD]
.
array
TA.MACD(inReal) TA.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.
optInFastPeriod
false
number
The optInSlowPeriod
parameter is used to set the slow period.
optInSlowPeriod
false
number
The optInSignalPeriod
parameter is used to set the signal period.
optInSignalPeriod
false
number
function main(){
// You can fill in different k-line periods, such as PERIOD_M1,PERIOD_M30,PERIOD_H1...
var records = exchange.GetRecords(PERIOD_M15)
var macd = TA.MACD(records, 12, 26, 9)
// Watching the logs, you can see that three arrays are returned, corresponding to DIF, DEA and MACD.
Log("DIF:", macd[0], "DEA:", macd[1], "MACD:", macd[2])
}
def main():
r = exchange.GetRecords(PERIOD_M15)
macd = TA.MACD(r, 12, 26, 9)
Log("DIF:", macd[0], "DEA:", macd[1], "MACD:", macd[2])
void main() {
auto r = exchange.GetRecords(PERIOD_M15);
auto macd = TA.MACD(r, 12, 26, 9);
Log("DIF:", macd[0], "DEA:", macd[1], "MACD:", macd[2]);
}
The TA
indicator library of FMZ Quant, optimized for common indicator algorithms. It supports JavaScript
, Python
, C++
language strategy calls, open source TA library code.
The default values of the optInFastPeriod
, optInSlowPeriod
, and optInSignalPeriod
parameters of the TA.MACD()
function are: 12
, 26
, and 9
.
{@fun/TA/TA.KDJ TA.KDJ}, {@fun/TA/TA.RSI TA.RSI}, {@fun/TA/TA.ATR TA.ATR}, {@fun/TA/TA.OBV TA.OBV}, {@fun/TA/TA.MA TA.MA}, {@fun/TA/TA.EMA TA.EMA}, {@fun/TA/TA.BOLL TA.BOLL}, {@fun/TA/TA.Alligator TA.Alligator}, {@fun/TA/TA.CMF TA.CMF}, {@fun/TA/TA.Highest TA.Highest}, {@fun/TA/TA.Lowest TA.Lowest}
Web3 TA.KDJ