Message-ID: <CAK2H+edAG_6ZsZn_oJ9i-s1BPCLrfr8x3dew=63E51BrF9MP0g@mail.gmail.com>
Date: 2014-09-10T17:35:22Z
From: Mark Knecht
Subject: quantstrat - problems adding multiple indicators
In-Reply-To: <54108520.7080609@braverock.com>
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