MCPcopy Index your code
hub / github.com/mpquant/Ashare / MACD

Function MACD

MyTT.py:86–89  ·  view source on GitHub ↗
(CLOSE,SHORT=12,LONG=26,M=9)

Source from the content-addressed store, hash-verified

84
85#------------------ 2级:技术指标函数(全部通过0级,1级函数实现) ------------------------------
86def MACD(CLOSE,SHORT=12,LONG=26,M=9): # EMA的关系,S取120日,和雪球小数点2位相同
87 DIF = EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
88 DEA = EMA(DIF,M); MACD=(DIF-DEA)*2
89 return RD(DIF),RD(DEA),RD(MACD)
90
91def KDJ(CLOSE,HIGH,LOW, N=9,M1=3,M2=3): # KDJ指标
92 RSV = (CLOSE - LLV(LOW, N)) / (HHV(HIGH, N) - LLV(LOW, N)) * 100

Callers

nothing calls this directly

Calls 2

EMAFunction · 0.85
RDFunction · 0.85

Tested by

no test coverage detected