[R-SIG-Finance] quantmod newTA passes a matrix?

Brian Lee Yung Rowe brian at muxspace.com
Tue Dec 9 12:30:06 CET 2008


Hi Jeff,

This is what I am talking about:

dummy.indicator <- function(x) cat("input class:",class(x),"\n")
myIndicator <- newTA(dummy.indicator, on=-1, col='#3333333', border=NA)

> chartSeries(QQQQ)
> myIndicator()
input class: matrix 

I wasn't expecting to see the input (extracted from the chob) as matrix
(I thought it would be xts/zoo).

Brian


On Sat, 2008-12-06 at 11:34 -0600, Jeff Ryan wrote:
> Hi Brian,
> 
> There are quite a few operations that take place internal to the
> chartSeries plotting process.
> 
> If you mean that your function that is creating the data isn't
> returning an xts object, I would say that you should do one of two
> things:
> 
> 1) write a wrapper that returns it as an xts object, either by
> reconstructing the xts object from the data, or by trying the Reclass
> function in xts.  Reclass is theory will do exactly what I think you
> need, but it can't always guess correctly. Use THIS function as the
> FUN argument to ?newTA.
> 
> 2) using ?fix you can simply modify/fine-tune the function object you
> get/have from newTA to modify the results.
> 
> If you could send your code off-list (if need be) or on list, I can help more.
> 
> Thanks,
> Jeff
> 
> On Sat, Dec 6, 2008 at 7:51 AM, Brian Lee Yung Rowe <brian at muxspace.com> wrote:
> > Hi Brian,
> >
> > Are you referring to the addTA function that takes a boolean xts object?
> > Yes, that works fine, but I want my own function that wraps up some of the
> > details in drawing the shaded regions. Jeff and I spoke about using newTA to
> > do this, and I'm trying to work through some of the specifics.
> >
> > FWIW I already have a working function based on newTA, but I have to pass in
> > the original time series as an option because the series extracted from the
> > chob does not preserve the date information. It's a minor inconvenience, and
> > I wanted to know if there was a more elegant solution to the problem.
> >
> > Brian
> >
> >
> > ----- Original message -----
> > Sent: 2008/12/06 06:58:37
> > Subject: Re:Re: [R-SIG-Finance] quantmod newTA passes a matrix?
> >
> > I'm not at a machine where I can easily look up the function, but quantmod
> > already has a function for adding shaded sections to charts that takes a
> > vector of date ranges as the argument. Check the chart documentation and
> > Jeff's excellent examples on quantmod.com
> >
> > Regards,
> >
> > - Brian
> >
> > Brian Lee Yung Rowe wrote:
> >
> >>_______________________________________________
> >>R-SIG-Finance at stat.math.ethz.ch mailing list
> >>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >>-- Subscriber-posting only.
> > _______________________________________________
> > 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