?
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)? ?