Skip to content

quantstrat add.indicator change (mktdata) to (mktdata)[, 1]

2 messages · Rob Schmidt, Brian G. Peterson

#
Hi All,

As the world marches forward, my newbie quantstrat examples have become
broken.  (How dare they change anything!)  I was unaware, so thanks to Scott
Schmidt for pointing out that functions of mktdata in the add.indicator
command now have a column specified.  For example Cl(mktdata) becomes
Cl(mktdata)[,1].  Also we should update to the latest versions like I
finally did.

Best regards,

Rob




--
View this message in context: http://r.789695.n4.nabble.com/quantstrat-add-indicator-change-mktdata-to-mktdata-1-tp4664153.html
Sent from the Rmetrics mailing list archive at Nabble.com.
#
On 04/13/2013 03:51 PM, Rob Schmidt wrote:
It would be more accurate to say that moving average functions in TTR 
now paste the MA type and periodicity onto the name of the data they are 
passed.

So, if you have and xts OHLC object called x, with standard 
getSymbols-style naming, it would have a column called x.Close.

If you extract that column with Cl(x) as input to SMA(Cl(x),20), you'll 
get back a column called x.Close.SMA.20.  The quantstrat indicators code 
will cbind that to mktdata

If you now call Cl(mktdata), you'll get two columns back: x.Close and 
x.Close.SMA.20.

So now you need to specify which one you want in later operations.

Regards,

   - Brian