Skip to content

Commit

Permalink
Update MyTT.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mpquant authored Dec 4, 2021
1 parent 1f80845 commit da09aa9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MyTT.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def WMA(S, N): #通达信S序列的N日加权移动平均 Yn = (1*X1+

def DMA(S, A): #求S的动态移动平均,A作平滑因子,必须 0<A<1 (此为核心函数,非指标)
if isinstance(A,(int,float)): return pd.Series(S).ewm(alpha=A,adjust=False).mean().values
A=np.nan_to_num(A,1.0); Y= np.zeros(len(S)); Y[0]=S[0] #A支持序列 by jqz1226
for i in range(1,len(S)): Y[i]=A[i]*S[i] + (1-A[i]) * Y[i-1]
A=np.array(A); A[np.isnan(A)]=1.0; Y= np.zeros(len(S)); Y[0]=S[0]
for i in range(1,len(S)): Y[i]=A[i]*S[i]+(1-A[i])*Y[i-1] #A支持序列 by jqz1226
return Y

def AVEDEV(S, N): #平均绝对偏差 (序列与其平均值的绝对差的平均值)
Expand Down

0 comments on commit da09aa9

Please sign in to comment.