MCPcopy
hub / github.com/mpquant/Ashare / EMA

Function EMA

MyTT.py:39–40  ·  view source on GitHub ↗
(S,N)

Source from the content-addressed store, hash-verified

37 return pd.Series(S).rolling(N).min().values
38
39def EMA(S,N): #指数移动平均,为了精度 S>4*N EMA至少需要120周期
40 return pd.Series(S).ewm(span=N, adjust=False).mean().values
41
42def SMA(S, N, M=1): #中国式的SMA,至少需要120周期才精确 (雪球180周期) alpha=1/(1+com)
43 return pd.Series(S).ewm(alpha=M/N,adjust=False).mean().values #com=N-M/M

Callers 3

MACDFunction · 0.85
KDJFunction · 0.85
TRIXFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected