-
-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Value of RSI Indicator does not match with Tradingview or PandasTA #471
Comments
I tested with vectorbtpro and compared several prices with Talib. I confirm that they are all different. I am not familiar with pandas-ta and did not test with it. I could not explain exactly why though. I could not find obvious mistake, I think ma_nb is different from the implementation in Talib. I made 2 generic examples that could bring on the track. So a succession of 1 and 2. With vbt: 2018-01-14 NaN Replacing the last 2 by a 1: With Talib: With vbt 2018-01-14 NaN 46.153846 is 6/13. So I understand how vbt calculates, but not Talib. |
I think, I found the difference And RMA is https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/overlap/rma.py VBT uses a normal MA, and Pandas_ta an exponential one. Reading this: https://www.macroption.com/rsi-calculation/ Part "Step 2: Averaging the Advances and Declines", it seems to be a choice. |
Great analysis, as a rule of thumb: use vbt's methods for regular SMA/EMA, and talib for Wilder's. Both have the same performance (talib is slightly faster), and you can always convert between different smoothing methods, see the comment above. |
I wanted to backtest using RSI, but the values seem to be different as compared to PandasTA or tradingview.
Values from tradingview match the PandasTA
import vectorbt as vbt
import yfinance as yf
nifty = yf.download(tickers="^NSEI",period="MAX", interval="1D")["Close"] #Nifty_50 Indian Index
rsi = vbt.RSI.run(nifty, window = 14)
print(rsi.rsi)
Real Values of RSI -
58.6 - 8th
56.31 - 7th
52.32 - 6th
Is anyone else facing the same issue?
@barnjamin @polakowo @RileyMShea @emiliobasualdo @kmcentush
The text was updated successfully, but these errors were encountered: