MCPcopy Index your code
hub / github.com/tkfy920/qstock / MACD

Function MACD

plot/chart_plot.py:26–38  ·  view source on GitHub ↗
(close, short=12, long=26, signal=9)

Source from the content-addressed store, hash-verified

24
25# 计算MACD
26def MACD(close, short=12, long=26, signal=9):
27 ema12 = pd.DataFrame.ewm(close, span=short).mean()
28 ema26 = pd.DataFrame.ewm(close, span=long).mean()
29 # dif组成的线叫MACD线
30 dif = ema12 - ema26
31 # dea组成的线叫signal线
32 dea = pd.DataFrame.ewm(dif, span=signal).mean()
33 # dif与dea的差得到柱状
34 hist = 2 * (dif - dea)
35 dif = np.round(dif, 3)
36 dea = np.round(dea, 3)
37 hist = np.round(hist, 3)
38 return dif, dea, hist
39
40#计算修正K线数据
41def Heikin_Ashi(df):

Callers 1

klineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected