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

Function SMA

MyTT.py:42–43  ·  view source on GitHub ↗
(S, N, M=1)

Source from the content-addressed store, hash-verified

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
44
45def AVEDEV(S,N): #平均绝对偏差 (序列与其平均值的绝对差的平均值)
46 avedev=pd.Series(S).rolling(N).apply(lambda x: (np.abs(x - x.mean())).mean())

Callers 1

RSIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected