The RSI
calculated in R is different than that I see in Yahoo-Finance. Yahoo-Finance documentation says it uses SMA
and close
. I done the same in R but the values don't match. I am not sure which one to trust. I tried both close & Adjusted close.
library(quantmod)
getSymbols("AAPL", from = '2021-05-01', to = '2021-06-16')
price <- Cl(AAPL) #Close Price
RSI(price, SMA, n = 5)
R output of RSI(5, Close):
AdjClose <- Ad(AAPL) # Adjusted close
RSI(AdjClose, SMA, n = 5)