?
TR真實(shí)波幅源碼公式
?
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指標(biāo)。talib自帶的有atr不過計(jì)算出來的值和圖表不對,所以我這里計(jì)算tr然后均值得到的就一樣了
?
print(talib.SMA(tr,14))
?
?
注:在金融領(lǐng)域就有這樣一個(gè)標(biāo)準(zhǔn)庫叫TAlib集成了幾乎所有你會(huì)使用到的那些基于k線分析的指標(biāo)。TAlib官網(wǎng)是全英的,另外他的函數(shù)列表可以看這個(gè)鏈接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)? ?