[R-SIG-Finance] quantstrat - problems adding multiple indicators
Mark Knecht
markknecht at gmail.com
Wed Sep 10 19:35:22 CEST 2014
On Wed, Sep 10, 2014 at 10:06 AM, Brian G. Peterson <brian at braverock.com> wrote:
> This has been discussed on this list multiple times.
>
> TTR is taking the column namees of your market data and appending the
> indicator.
>
> so:
>
> Cl(mktdata)
>
> will return multiple columns after the first indicator has been applied.
>
> you most likely want
>
> quote(Cl(mktdata)[,1])
>
> to get only the first column.
>
> Brian
>
Ah, indeed, that does work, although Googling for 'quantstrat' and
'quote(Cl(mktdata)[,1])' doesn't turn up much.
None the less, I now see that Cl() is finding all names with 'close'
anywhere in the name which indeed isn't want I thought it was doing
and the first one is the one I want:
> head(Cl(mktdata))
SPY.Close SPY.Close.SMA.50.ind3 SPY.Close.SMA.200.ind4
2008-12-31 82.08 NA NA
2009-01-02 84.56 NA NA
2009-01-05 84.46 NA NA
2009-01-06 85.02 NA NA
2009-01-07 82.47 NA NA
2009-01-08 82.81 NA NA
Thanks for the quick (and reasonably friendly!) ;-) response.
Cheers,
Mark
More information about the R-SIG-Finance
mailing list