Talib技术因子详解(六)

10 篇文章 49 订阅
10 篇文章 9 订阅

talib安装方式:pip install Ta-lib

Tushare数据获取请参考:金融量化分析基础环境搭建

数据获取代码请参考:Talib技术因子详解(一)

46、NATR名称:归一化波动幅度均值,调用方式如下:

output = talib.NATR(high, low, close, timeperiod)

47、TRANGE 名称:真正的波幅,调用方式如下:

output = talib.TRANGE(high, low, close)

48、AVGPRICE 名称:平均价格函数,调用方式如下:

output = talib.AVGPRICE(open, high, low, close)

49、MEDPRICE 名称:中位数价格,调用方式如下:

output = talib.MEDPRICE(high, low)

50、TYPPRICE名称:代表性价格,调用方式如下:

output = talib.TYPPRICE(high, low, close)

51、WCLPRICE名称:加权收盘价,调用方式如下:

output = talib.WCLPRICE(high, low, close)

52、HT_DCPERIOD名称: 希尔伯特变换-主导周期,调用方式如下:

output = talib.HT_DCPERIOD(close)

将价格作为信息信号,计算价格处在的周期的位置,作为择时的依据。

53、HT_DCPHASE名称: 希尔伯特变换-主导循环阶段,调用方式如下:

output = talib.HT_DCPHASE(close)

54、HT_DCPHASE名称: 希尔伯特变换-主导循环阶段,调用方式如下:

inphase, quadrature = talib.HT_PHASOR(close)

55、HT_DCPHASE 名称: 希尔伯特变换-正弦波,调用方式如下:

sine, leadsine = talib.HT_PHASOR(close)

56、HT_DCPHASE名称: 希尔伯特变换-趋势与周期模式,调用方式如下:

output = talib.HT_TRENDMODE(close)

部分代码

#46、NATR名称:归一化波动幅度均值
    # output = tl.NATR(high_price_arr, low_price_arr, close_price_arr, timeperiod=14)
    
    #47、TRANGE 名称:真正的波幅
    # output = tl.TRANGE(high_price_arr, low_price_arr, close_price_arr)
    
    #Price Transform Functions 价格指标https://www.jianshu.com/p/46d0a77a6df2
    #48、AVGPRICE 名称:平均价格函数
    # output = tl.AVGPRICE(open_price_arr, high_price_arr, low_price_arr, close_price_arr)

    #49、MEDPRICE 名称:中位数价格
    # output = tl.MEDPRICE(high_price_arr, low_price_arr)
    
    #50、TYPPRICE名称:代表性价格
    # output = tl.TYPPRICE(high_price_arr, low_price_arr, close_price_arr)
    
    #51、WCLPRICE名称:加权收盘价
    # output = tl.WCLPRICE(high_price_arr, low_price_arr, close_price_arr)
    
    #Cycle Indicator Functions 周期指标https://www.jianshu.com/p/3ccff62f07e4
    #52、HT_DCPERIOD名称: 希尔伯特变换-主导周期
    #简介:将价格作为信息信号,计算价格处在的周期的位置,作为择时的依据
    # output = tl.HT_DCPERIOD(close_price_arr)
    
    #53、HT_DCPHASE名称: 希尔伯特变换-主导循环阶段
    # output = tl.HT_DCPHASE(close_price_arr)
    
    #54、HT_PHASOR名称: 希尔伯特变换-希尔伯特变换相量分量
    # inphase, quadrature = tl.HT_PHASOR(close_price_arr)
    
    #55、HT_DCPHASE 名称: 希尔伯特变换-正弦波
    # sine, leadsine = tl.HT_SINE(close_price_arr)
    
    # fig, ax1 = plt.subplots()
    # ax2 = ax1.twinx()
    # ax3 = ax1.twinx()
    # ax1.plot(close_price_arr, 'b')
    # ax2.plot(sine, 'r')
    # ax3.plot(leadsine, 'g')
    # ax1.set_ylabel('close', color='b')
    # ax2.set_ylabel('sine', color='r')
    # ax3.set_ylabel('leadsine', color='g')
    # plt.show()
    
    #56、HT_DCPHASE名称: 希尔伯特变换-趋势与周期模式
    output = tl.HT_TRENDMODE(close_price_arr)
    
    
    fig, ax1 = plt.subplots()
    ax2 = ax1.twinx()
    ax1.plot(close_price_arr, 'b')
    ax2.plot(output, 'r')
    ax1.set_ylabel('close', color='b')
    ax2.set_ylabel('output', color='r')
    plt.show()

完整代码请结合:Talib技术因子详解(一)

  • 2
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Coding的叶子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值