[R-SIG-Finance] TTR's RSI
Josh Ulrich
josh.m.ulrich at gmail.com
Wed Apr 29 17:07:42 CEST 2009
To provide closure, updating to the latest version of R and TTR
resolved this issue.
--
http://www.fosstrading.com
On Tue, Apr 28, 2009 at 11:28 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
> Hi Josh,
> thanks for your help. I tried so many different things that I am not
> exactly sure what it was that made it work. I installed the latest
> version of R and then I could install the latest version of TTR as
> well.
> Haky
>
> On Tue, Apr 28, 2009 at 7:41 PM, Josh Ulrich <josh.m.ulrich at gmail.com> wrote:
>> That's odd. Does your mirror have the updated Mac binary?
>>
>> You can use install.packages() to install from your local disk. See
>> the Examples in ?install.packages.
>>
>> Best,
>> Josh
>> --
>> http://quantemplation.blogspot.com
>> http://www.fosstrading.com
>>
>>
>>
>> On Tue, Apr 28, 2009 at 7:32 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
>>> I see... Thanks.
>>>
>>> But when I install TTR using install.packages, I get version 0.14.
>>>
>>> I downloaded the new version in my hard drive but I'm not sure how to
>>> install from local drive. I am using MacOs.
>>> Do you know how to do this on a Mac?
>>>
>>> Thanks
>>> Haky
>>>
>>>
>>>
>>> On Tue, Apr 28, 2009 at 7:08 PM, Josh Ulrich <josh.m.ulrich at gmail.com> wrote:
>>>> Haky,
>>>>
>>>> It appears you're not using TTR_0.2. You should not have this issue
>>>> with the newest version.
>>>>
>>>> Best,
>>>> Josh
>>>> --
>>>> http://quantemplation.blogspot.com
>>>> http://www.fosstrading.com
>>>>
>>>>
>>>>
>>>> On Tue, Apr 28, 2009 at 6:46 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
>>>>> well... this time with the attachment
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Apr 28, 2009 at 6:43 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
>>>>>> Hi Josh,
>>>>>>
>>>>>> I am attaching the following files
>>>>>>
>>>>>> test.Rdata (with data.xmin, the xts object)
>>>>>> replic.r
>>>>>> replic.output.txt (output when I source replic.r)
>>>>>>
>>>>>> Thanks
>>>>>> Haky
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 28, 2009 at 5:49 PM, Josh Ulrich <josh.m.ulrich at gmail.com> wrote:
>>>>>>> Hi Haky,
>>>>>>>
>>>>>>> Could you provide more information? I cannot replicate your results.
>>>>>>>
>>>>>>>> Lines <- " 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"
>>>>>>>> data.60min <- read.table(textConnection(Lines))
>>>>>>>> dim(data.60min)
>>>>>>> [1] 23 5
>>>>>>>> #class(data.xmin) # I don't know what the 'data.xmin' object is...
>>>>>>>> class(data.60min)
>>>>>>> [1] "data.frame"
>>>>>>>> length(RSI(data.60min[,"Close"]))
>>>>>>> [1] 23
>>>>>>>> length(RSI(as.xts(data.60min)[,"Close"]))
>>>>>>> [1] 23
>>>>>>>> sessionInfo()
>>>>>>> R version 2.9.0 (2009-04-17)
>>>>>>> i386-unknown-freebsd7.1
>>>>>>>
>>>>>>> locale:
>>>>>>> C
>>>>>>>
>>>>>>> attached base packages:
>>>>>>> [1] stats graphics grDevices utils datasets methods base
>>>>>>>
>>>>>>> other attached packages:
>>>>>>> [1] TTR_0.2-1 xts_0.6-4 zoo_1.5-5
>>>>>>>
>>>>>>> loaded via a namespace (and not attached):
>>>>>>> [1] grid_2.9.0 lattice_0.17-22
>>>>>>>
>>>>>>> Best,
>>>>>>> Josh
>>>>>>> --
>>>>>>> http://quantemplation.blogspot.com
>>>>>>> http://www.fosstrading.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Apr 28, 2009 at 5:29 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
>>>>>>>> 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
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>>>>>> -- Subscriber-posting only.
>>>>>>>> -- If you want to post, subscribe first.
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
More information about the R-SIG-Finance
mailing list