MCPcopy Create free account
hub / github.com/mpquant/Ashare / AVEDEV

Function AVEDEV

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

Source from the content-addressed store, hash-verified

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())
47 return avedev.values
48
49def SLOPE(S,N,RS=False): #返S序列N周期回线性回归斜率 (默认只返回斜率,不返回整个直线序列)
50 M=pd.Series(S[-N:]); poly = np.polyfit(M.index, M.values,deg=1); Y=np.polyval(poly, M.index);

Callers 1

CCIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected