0
$\begingroup$

I have my data stored in df1 with the columns: Date Time Open High Low Close Vol OI I want to calculate the 20 period ATR from my df1. Using TA-Lib I have tried the following which gives an error:

todayATR = talib.ATR(df1['High'],df1['Low'],df1['Close'],timeperiod=20)

I am new to python so I might have missed something simple.

$\endgroup$

1 Answer 1

1
$\begingroup$

talib functions do not accept pandas time series as inputs. Try

talib.ATR(df1['High'].values, df1['Low'].values, df1['Close'].values, timeperiod=20)

instead.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.