[R-SIG-Finance] Cant get this Quantstrat going,

Brian G. Peterson brian at braverock.com
Sat May 5 13:13:27 CEST 2012


On Sat, 2012-05-05 at 03:55 -0700, gussinsky wrote:
> Not sure I understand, CCI is a function in TTR, I have tested it on the
> mktdata and it works:
> 
> x = CCI(HLC(mktdata))
> 
> works fine.

CCI does put NA's at the beginning of the data series.  If that is a
problem for the rest of your logic, then you'll need to fix that.  As I
said already, all that applyIndicators does is call your indicator
function.  

This works:

require(quantstrat)
getSymbols('IBM')
CCI(HLC(IBM))
nrow(IBM) == nrow(CCI(HLC(IBM)))
#TRUE
strategy('test', store=TRUE)
add.indicator(strategy = 'test', name = "CCI", arguments = list(HLC =
quote(HLC(mktdata))), label="CCI")
applyIndicators('test',mktdata=IBM)
applyIndicators('test',mktdata=IBM)$CCI == CCI(HLC(IBM))
# TRUE for every row

I'm not going to debug your strategy for you.


-- 
Brian



More information about the R-SIG-Finance mailing list