Gardn Water
Gardn Water

Reputation: 1

R : quantmod's chartSeries addRSI show different answer than TTR's RSI

Difference seen between quantmod package’s chartSeries()+addRSI() and TTR’s RSI()

chartSeries shows RSI at 54.50 and TTR shows it at 73.49

Any reason why the difference ?

Thanks GW

todate = Sys.Date()
fromdate = '2015-01-01'
tick = "STZ"
getSymbols(tick, src = 'yahoo', from = fromdate, to = todate)
chartSeries(STZ ,name = tick, theme="white",  TA="addRSI()")
price <- Cl(STZ)
rsi <- RSI(price,  2)
tail(rsi)

                 EMA
2016-09-23 88.804068
2016-09-26 40.403057
2016-09-27 57.262952
2016-09-28 28.881392
2016-09-29  8.375952
2016-09-30 73.493351

Upvotes: 0

Views: 329

Answers (1)

FXQuantTrader
FXQuantTrader

Reputation: 6891

rsi <- RSI(price, 2) is using n=2, whereas addRSI is using the default n=14 since you did not pass in the value of n in addRSI.

Upvotes: 1

Related Questions