Hi,
I tried the follow code but It didn't work correctly and it return "None" in the Atr field.
Can someone help me please? Thanks
Price Close High Low Open Volume atr
Ticker EURUSD=X EURUSD=X EURUSD=X EURUSD=X EURUSD=X
Date
2022-01-03 1.137346 1.137592 1.128541 1.137385 0 None
2022-01-04 1.130224 1.132300 1.127345 1.130199 0 None
2022-01-05 1.128363 1.134559 1.127764 1.128541 0 None
2022-01-06 1.131350 1.133067 1.128554 1.131222 0 None
2022-01-07 1.129688 1.135976 1.129050 1.129586 0 None
... ... ... ... ... ... ...
2025-02-14 1.046167 1.051370 1.044812 1.046167 0 None
2025-02-17 1.048922 1.050707 1.046737 1.048922 0 None
2025-02-18 1.048537 1.048647 1.044277 1.048537 0 None
2025-02-19 1.044834 1.046244 1.040507 1.044834 0 None
2025-02-20 1.042753 1.044059 1.042210 1.042862 0 None
[/error]
I tried the follow code but It didn't work correctly and it return "None" in the Atr field.
Can someone help me please? Thanks
import pandas as pd import pandas_ta as ta import yfinance as yf data = yf.download("EURUSD=X", start='2022-01-01', end=datetime.now()) data['atr'] = (ta.atr(data['High'],data['Low'],data['Close'], 14)) print(data)[Output]
Price Close High Low Open Volume atr
Ticker EURUSD=X EURUSD=X EURUSD=X EURUSD=X EURUSD=X
Date
2022-01-03 1.137346 1.137592 1.128541 1.137385 0 None
2022-01-04 1.130224 1.132300 1.127345 1.130199 0 None
2022-01-05 1.128363 1.134559 1.127764 1.128541 0 None
2022-01-06 1.131350 1.133067 1.128554 1.131222 0 None
2022-01-07 1.129688 1.135976 1.129050 1.129586 0 None
... ... ... ... ... ... ...
2025-02-14 1.046167 1.051370 1.044812 1.046167 0 None
2025-02-17 1.048922 1.050707 1.046737 1.048922 0 None
2025-02-18 1.048537 1.048647 1.044277 1.048537 0 None
2025-02-19 1.044834 1.046244 1.040507 1.044834 0 None
2025-02-20 1.042753 1.044059 1.042210 1.042862 0 None
[/error]