简体   繁体   中英

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

rsi <- RSI(price, 2) addRSI rsi <- RSI(price, 2)使用n=2 ,而addRSI使用默认n=14因为您没有在addRSI传递n的值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM