def TRIX(df, n):
EX1 = pd.ewma(df['close'], span = n, min_periods = n - 1, adjust = False)
EX2 = pd.ewma(EX1, span = n, min_periods = n - 1, adjust = False)
EX3 = pd.ewma(EX2, span = n, min_periods = n - 1, adjust = False)
return pd.Series(EX3/EX3.shift(1) - 1, name = 'Trix' + str(n))
#Average Directional Movement Index
评论列表
文章目录