Skip to content

quantmod: addTA is broken?

6 messages · Gabor Grothendieck, Brian Lee Yung Rowe, Michael Zak +1 more

#
Hi there

I have here some financial charts which I did a couple of months ago  
with quantmod. Today, I recharted my data with chartSeries(), which  
works fine. As soon as I add some indicators with addTA() I get a  
error message.

For example:
require(quantmod)
require(TTR)
getSymbols("YHOO")
chartSeries(YHOO)
min55 <- runMin(YHOO$YHOO.Low, 55)
addTA(min55, on = 1)


I get this message:

Warning messages:
1: In merge.zoo(lchob at xdata, ta, join = "left", retside = c(FALSE,  :
   Index vectors are of different classes: POSIXt POSIXt integer integer


How can I solve this?

Thank you, Michael
#
That's a warning message, not an error message.  This suppresses it:

suppressWarnings(plot(addTA(min55, on = 1)))
On Sun, Dec 14, 2008 at 5:14 AM, Michael Zak <zakdump at gmail.com> wrote:
#
You're absolutely right. I gave you a wrong example.

Let's say I have OHLC data from Cotton over the last 80 days. In a  
spreadsheet I got from a client the computed EMA values for cotton's  
daily high. So I import the computed values (the last 80) in R like  
this:

require(quantmod)
CottonSpreadsheet <- read.table(...)
CottonSpreadsheet <- last(CottonSpredsheet, 80)
OHLC <- last(Cotton, 80)
chartSeries(OHLC, type = "bars")
addTA(CottonSpeadsheet)

Now I got this error message:

Fehler in tav * 0.975 : nicht-numerisches Argument f?r bin?ren Operator
Zus?tzlich: Warning message:
In merge.zoo(lchob at xdata, ta, join = "left", retside = c(FALSE,  :
   Index vectors are of different classes: POSIXt POSIXt integer integer

I get the chartSeries(), but without the added addTA. I don't know why  
this first line of the error message is in German. I hope you can help  
me anyway.

Thank you, Michael
On 14.12.2008, at 13:40, Gabor Grothendieck wrote:

            
#
Michael,

It's hard to speculate without knowing what the data you have looks
like. Can you send the output of
 class(CottonSpreadsheet)
 colnames(CottonSpreadsheet)
? 

Also, did you run with debug(addTA)? You can probably narrow down the
problem by stepping through the function yourself.

Brian
On Sun, 2008-12-14 at 14:23 +0100, Michael Zak wrote:
#
[1] "data.frame"

 > colnames(CottonSpreadsheet)
[1] "V1"               "orginal_EMA_High"

I tried to find the error with debug(addTA), without success. As soon  
as I execute addTA() I get this error message. I tried it with a  
vector or a xts object (always with the same length as the OHLC xts  
object is). Funny thing is, I see the EMA values, but some other  
strange curves too (which I don't want!).

I did a screenshot: http://zak.li/linked/quantmod.png

But, oh what a success. I downgraded quantmod from 3.7 to 3.6 and  
everything works fine now.

Thank you all, Michael
On 14.12.2008, at 15:14, Brian Lee Yung Rowe wrote:

            
#
Hi Michael,

The issue is an incompatibility between the newest quantmod and the
current CRAN version of xts.  So downgrading quantmod should solve the
issue (as you have seen).

Though it was intended to be released last week, xts_0.6-2 (the newest
xts) has some additional features that addTA takes advantage of.  A
chicken and the egg, in which the chicken won...

That is what you are seeing in your output ... merge.xts now has a
join and retside arg that is getting misinterpreted by the old
merge.xts.

xts is wrapping up testing now, and should be ready for CRAN in the
next day or two.

Thanks,
Jeff
On Sun, Dec 14, 2008 at 8:29 AM, Michael Zak <zakdump at gmail.com> wrote: