1

I have a OHLC data frame, and trying to calculate the RSI without charting witin R.

Looking to do the same thing as below but for RSI;

BBands(HLC(stock))

> RSI(HLC(stock))
Error in `[.xts`(up, which.dn) : subscript out of bounds
> RSI(Close(stock))
Error in inherits(x, "xts") : could not find function "Close"
> RSI(C(stock))
Error in C(stock) : object not interpretable as a factor

head(stock)
                   minutes.Open minutes.High minutes.Low minutes.Close

2014-08-04 01:00:00      102.561      102.581     102.486       102.537
2014-08-04 05:00:00      102.536      102.677     102.530       102.673
2014-08-04 09:00:00      102.668      102.713     102.537       102.597
2014-08-04 13:00:00      102.591      102.656     102.578       102.578
2014-08-04 17:00:00      102.570      102.572     102.438       102.487
2014-08-04 21:00:00      102.481      102.584     102.460       102.584

chartSeries(stock)
addBBands()

1 Answer 1

2

Install package TTR

require(TTR)
rsi <- RSI(stock$minutes.Close)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.