Due to a change in SMA and a change in quantstrat (from revison 1411 to 1415?) of indicators.R I cant find an easy way of setting the column name of an indicator in quantstrat. Does anyone know of an easy way of setting the column name of an indicator?


More detailed description:

>From the following code I used to get an indicator column named  only "XXX":

strategy("example", store=TRUE)
getSymbols("SPY", src='yahoo')
add.indicator('example', 'SMA', arguments=list(x=quote(Ad(SPY)), n=20), label="XXX")
str(getStrategy('example')$indicators)
out <- applyIndicators('example', SPY)
tail(out)

Results in:

           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted SPY.Adjusted.SMA.20.XXX
2013-08-09   169.58   170.10  168.72    169.31   91757700       169.31                169.1540
2013-08-12   168.46   169.31  168.38    169.11   68323300       169.11                169.2020
2013-08-13   169.41   169.90  168.41    169.61   80643600       169.61                169.3065
2013-08-14   169.53   169.80  168.70    168.74   79468400       168.74                169.3460
2013-08-15   167.41   167.43  166.09    166.38  152033600       166.38                169.2215
2013-08-16   166.06   166.63  165.50    165.83  130552300       165.83                169.0545


But now it is named "SPY.Adjusted.SMA.20.XXX". Some of the problem is due to SMA now appends SMA.<n> to the column name.
Using an older version of SMA or changing the function from SMA to runMean still dont fix the problem:

strategy("example", store=TRUE)
getSymbols("SPY", src='yahoo')
add.indicator('example', 'runMean', arguments=list(x=quote(Ad(SPY)), n=20), label="XXX")
str(getStrategy('example')$indicators)
out <- applyIndicators('example', SPY)
tail(out)

Results in:

           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted   X1.XXX
2013-08-09   169.58   170.10  168.72    169.31   91757700       169.31 169.1540
2013-08-12   168.46   169.31  168.38    169.11   68323300       169.11 169.2020
2013-08-13   169.41   169.90  168.41    169.61   80643600       169.61 169.3065
2013-08-14   169.53   169.80  168.70    168.74   79468400       168.74 169.3460
2013-08-15   167.41   167.43  166.09    166.38  152033600       166.38 169.2215
2013-08-16   166.06   166.63  165.50    165.83  130552300       165.83 169.0545


Does anyone know of an easy way to get the indicator to be named only "XXX"?
The reason I need control over the name is that I use the column later in sigFormula.

Fridthjof




	[[alternative HTML version deleted]]

