Skip to content

Commit

Permalink
Update MyTT.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mpquant authored Jun 27, 2021
1 parent f6feb31 commit b8f3e88
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 @@ -38,10 +38,10 @@ def HHV(S,N): # HHV(C, 5) # 最近5天收盘最高价
def LLV(S,N): # LLV(C, 5) # 最近5天收盘最低价
return pd.Series(S).rolling(N).min().values # pd.rolling_min(S,N) (Python2)

def EMA(S,N): #指数移动平均,为了精度 S>4*N EMA至少需要120周期
def EMA(S,N): #指数移动平均,为了精度 S>4*N EMA至少需要120周期 alpha=2/(span+1)
return pd.Series(S).ewm(span=N, adjust=False).mean().values #pd.ewma(S,span=N,adjust=False) (Python2)

def SMA(S, N, M=1): #中国式的SMA,至少需要120周期才精确 (雪球180周期)
def SMA(S, N, M=1): #中国式的SMA,至少需要120周期才精确 (雪球180周期) alpha=1/(1+com)
return pd.Series(S).ewm(com=N-M, adjust=True).mean().values #pd.ewma(S,com=N-M,adjust=True) (Python2)

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

0 comments on commit b8f3e88

Please sign in to comment.