vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 33
声望: 1

description

如题,我用的1分钟级别的bar 传入的周期n是9.,算出来的K,D 始终没值(看控制台输出),大家知道问题出在哪儿吗。或者你们有能用的KDJ的指标能贴一个出来吗?我参考参考

Member
加入于:
帖子: 77
声望: 17

`
def kdj(self, fastk_period, slowk_period, slowk_matype, slowd_period, slowd_matype, array=False):
"""KDJ指标"""

    slowk, slowd = talib.STOCH(self.high, self.low, self.close, fastk_period, slowk_period,
                               slowk_matype, slowd_period, slowd_matype)

    # 求出J值,J = (3 * D) - (2 * K)
    slowj = list(map(lambda x, y: 3 * x - 2 * y, slowk, slowd))
    if array:
        return slowk, slowd, slowj
    return slowk[-1], slowd[-1], slowj[-1]

`

Member
avatar
加入于:
帖子: 33
声望: 1

张国平 wrote:

`
def kdj(self, fastk_period, slowk_period, slowk_matype, slowd_period, slowd_matype, array=False):
"""KDJ指标"""

    slowk, slowd = talib.STOCH(self.high, self.low, self.close, fastk_period, slowk_period,
                               slowk_matype, slowd_period, slowd_matype)

    # 求出J值,J = (3 * D) - (2 * K)
    slowj = list(map(lambda x, y: 3 * x - 2 * y, slowk, slowd))
    if array:
        return slowk, slowd, slowj
    return slowk[-1], slowd[-1], slowj[-1]

`
你把你写的帖子移动到csdn,哪里人比itpub要多吧

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3