Last chance! 50% off unlimited learning
Sale ends in
RSI(price, n=14, maType, ...)
maType
function in case (1) above.price
or a vector (if try.xts
fails) containing the RSI values.RSI = 100 - 100 / ( 1 + RS )
, where RS
is the smoothed
ratio of 'average gains over 'average' losses. The 'averages' aren't true
averages, since they're divided by the value of n
not the number of gain/loss periods.EMA
, SMA
, etc. for moving average options; and note
Warning section. See CMO
for a variation on RSI.data(ttrc)
price <- ttrc[,"Close"]
# Default case
rsi <- RSI(price)
# Case of one 'maType' for both MAs
rsiMA1 <- RSI(price, n=14, maType="WMA", wts=ttrc[,"Volume"])
# Case of two different 'maType's for both MAs
rsiMA2 <- RSI(price, n=14, maType=list(maUp=list(EMA,ratio=1/5),
maDown=list(WMA,wts=1:10)))
Run the code above in your browser using DataLab