data_handler.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:pyktrader2 作者: harveywwu 项目源码 文件源码
def ADX(df, n):
    return pd.Series(talib.ADX(df['high'].values, df['low'].values, df['close'].values, timeperiod = n), index = df.index, name = 'ADX_%s' % str(n))
    # UpMove = df['high'] - df['high'].shift(1)
    # DoMove = df['low'].shift(1) - df['low']
    # UpD = pd.Series(UpMove)
    # DoD = pd.Series(DoMove)
    # UpD[(UpMove<=DoMove)|(UpMove <= 0)] = 0
    # DoD[(DoMove<=UpMove)|(DoMove <= 0)] = 0
    # ATRs = ATR(df,span = n, min_periods = n)
    # PosDI = pd.Series(pd.ewma(UpD, span = n, min_periods = n - 1) / ATRs)
    # NegDI = pd.Series(pd.ewma(DoD, span = n, min_periods = n - 1) / ATRs)
    # ADX = pd.Series(pd.ewma(abs(PosDI - NegDI) / (PosDI + NegDI), span = n_ADX, min_periods = n_ADX - 1), name = 'ADX' + str(n) + '_' + str(n_ADX))
    # return ADX
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号