talib python文档_Ta-lib 函数一览

importtkinter as tkfrom tkinter importttkimportmatplotlib.pyplot as pltimportnumpy as npimporttalib as ta

series= np.random.choice([1, -1], size=200)

close=np.cumsum(series).astype(float)#重叠指标

defoverlap_process(event):print(event.widget.get())

overlap=event.widget.get()

upperband, middleband, lowerband= ta.BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)

fig, axes= plt.subplots(2, 1, sharex=True)

ax1, ax2= axes[0], axes[1]

axes[0].plot(close,'rd-', markersize=3)

axes[0].plot(upperband,'y-')

axes[0].plot(middleband,'b-')

axes[0].plot(lowerband,'y-')

axes[0].set_title(overlap, fontproperties="SimHei")if overlap == '布林线':pass

elif overlap == '双指数移动平均线':

real= ta.DEMA(close, timeperiod=30)

axes[1].plot(real, 'r-')elif overlap == '指数移动平均线':

real= ta.EMA(close, timeperiod=30)

axes[1].plot(real, 'r-')elif overlap == '希尔伯特变换——瞬时趋势线':

real=ta.HT_TRENDLINE(close)

axes[1].plot(real, 'r-')elif overlap == '考夫曼自适应移动平均线':

real= ta.KAMA(close, timeperiod=30)

axes[1].plot(real, 'r-')elif overlap == '移动平均线':

real= ta.MA(close, timeperiod=30, matype=0)

axes[1].plot(real, 'r-')elif overlap == 'MESA自适应移动平均':

mama, fama= ta.MAMA(close, fastlimit=0, slowlimit=0)

axes[1].plot(mama, 'r-')

axes[1].plot(fama, 'g-')elif overlap == '变周期移动平均线':

real= ta.MAVP(close, periods, minperiod=2, maxperiod=30, matype=0)

axes[1].plot(real, 'r-')elif overlap == '简单移动平均线':

real= ta.SMA(close, timeperiod=30)

axes[1].plot(real, 'r-')elif overlap == '三指数移动平均线(T3)':

real= ta.T3(close, timeperiod=5, vfactor=0)

axes[1].plot(real, 'r-')elif overlap == '三指数移动平均线':

real= ta.TEMA(close, timeperiod=30)

axes[1].plot(real, 'r-')elif overlap == '三角形加权法':

real= ta.TRIMA(close, timeperiod=30)

axes[1].plot(real, 'r-')elif overlap == '加权移动平均数':

real= ta.WMA(close, timeperiod=30)

axes[1].plot(real, 'r-')

plt.show()#动量指标

defmomentum_process(event):print(event.widget.get())

momentum=event.widget.get()

upperband, middleband, lowerband= ta.BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)

fig, axes= plt.subplots(2, 1, sharex=True)

ax1, ax2= axes[0], axes[1]

axes[0].plot(close,'rd-', markersize=3)

axes[0].plot(upperband,'y-')

axes[0].plot(middleband,'b-')

axes[0].plot(lowerband,'y-')

axes[0].set_title(momentum, fontproperties="SimHei")if momentum == '绝对价格振荡器':

real= ta.APO(close, fastperiod=12, slowperiod=26, matype=0)

axes[1].plot(real, 'r-')elif momentum == '

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值