ta-lib-python icon indicating copy to clipboard operation
ta-lib-python copied to clipboard

ATR calculation

Open MHermand opened this issue 4 years ago • 1 comments

Hello :)

I tried to calculate ATR and check the result compare to the built in indicator by using the code below, unfortunately I cannot get the same datas as in the built-in indicator, I used it to build a freqtrade strategy, below is a piece of code :

import talib.abstract as ta

dataframe['atr1'] = ta.ATR(dataframe, timeperiod=10)

dataframe['tr']  = ta.TRANGE(dataframe)
dataframe['atr2'] = ta.MA(dataframe['tr'], timeperiod=10)
dataframe['atr3'] = ta.SMA(dataframe['tr'], timeperiod=10)
dataframe['atr4'] = ta.EMA(dataframe['tr'], timeperiod=10)

Why cannot I get the same datas as the dataframe['atr1'] ? :( Thanks for you help

MHermand avatar Feb 08 '22 22:02 MHermand

Perhaps this is relevant:

https://stackoverflow.com/questions/66322638/is-there-an-error-in-pythons-talib-atr-method

mrjbq7 avatar Feb 08 '22 22:02 mrjbq7