[R-SIG-Finance] TTR's RSI

Hae Kyung Im haky.im at gmail.com
Wed Apr 29 00:29:44 CEST 2009


Hi,

for some reason when I calculate RSI on a xts object of length n, I
get a result of length n+1 as in the following example:

> dim(data.60min)
[1] 23  5

> class(data.xmin)
[1] "xts" "zoo"

> length(RSI(data.60min[,"Close"]))
[1] 24

If I plug in a vector of length 23, RSI gives me a vector of length 23.

> length(RSI(runif(23)))
[1] 23

am I missing something here?

Thanks
Haky


--------------------------------------------
Here is the data for your reference:
> data.60min
                    Open High Low Close Volume
2008-03-16 17:00:00  119  120 119   119   1305
2008-03-16 18:00:00  119  120 119   120   3237
2008-03-16 19:00:00  120  120 120   120   2813
2008-03-16 20:00:00  120  120 120   120   2857
2008-03-16 21:00:00  120  120 120   120   4561
2008-03-16 22:00:00  120  120 120   120   1988
2008-03-16 23:00:00  120  120 120   120    805
2008-03-17 00:00:00  120  120 120   120   1177
2008-03-17 01:00:00  120  120 120   120   1245
2008-03-17 02:00:00  120  120 120   120   1263
2008-03-17 03:00:00  120  120 120   120   5565
2008-03-17 04:00:00  120  120 120   120   4081
2008-03-17 05:00:00  120  120 120   120   4462
2008-03-17 06:00:00  120  120 120   120  12409
2008-03-17 07:00:00  120  120 119   119  34083
2008-03-17 08:00:00  119  120 119   120  34742
2008-03-17 09:00:00  120  120 120   120  29412
2008-03-17 10:00:00  120  120 120   120  40087
2008-03-17 11:00:00  120  120 120   120  21834
2008-03-17 12:00:00  120  120 120   120  26442
2008-03-17 13:00:00  120  120 120   120  36671
2008-03-17 14:00:00  120  120 120   120  20468
2008-03-17 15:00:00  120  120 120   120   8802



More information about the R-SIG-Finance mailing list