打印本文打印本文 关闭窗口关闭窗口

TR真实波幅指标金字塔PYTHON码源

作者:原创 来源:本站原创 发布时间:2020年09月30日

 

TR真实波幅源码公式
 
num = -1
close = history_bars(\'RB00\',100,\'1d\',\'close\',include_now=True) 
high = history_bars(\'RB00\',100,\'1d\',\'high\',include_now=True)  
low = history_bars(\'RB00\',100,\'1d\',\'low\',include_now=True)   
tr = talib.TRANGE(high,low,close)
print(tr)
#tr的均值就是我们常用的atr指标。talib自带的有atr不过计算出来的值和图表不对,所以我这里计算tr然后均值得到的就一样了

 

print(talib.SMA(tr,14))

 

 

注:在金融领域就有这样一个标准库叫TAlib集成了几乎所有你会使用到的那些基于k线分析的指标。TAlib官网是全英的,另外他的函数列表可以看这个链接http://www.ta-lib.org/function.html。只有简单的说明

 
num = -1
close = history_bars(\'RB00\',100,\'1d\',\'close\',include_now=True) 
high = history_bars(\'RB00\',100,\'1d\',\'high\',include_now=True)  
low = history_bars(\'RB00\',100,\'1d\',\'low\',include_now=True)   
num = -1
close = history_bars(\'RB00\',100,\'1d\',\'close\',include_now=True) 
high = history_bars(\'RB00\',100,\'1d\',\'high\',include_now=True)  
low = history_bars(\'RB00\',100,\'1d\',\'low\',include_now=True)   
num = -1
close = history_bars(\'RB00\',100,\'1d\',\'close\',include_now=True) 
high = history_bars(\'RB00\',100,\'1d\',\'high\',include_now=True)  
low = history_bars(\'RB00\',100,\'1d\',\'low\',include_now=True)   
打印本文打印本文 关闭窗口关闭窗口