On Sat, 2012-05-05 at 03:37 -0700, gussinsky wrote:
> I also would like to point out, that the calculation of the CCI is
> wrong,all through the mktdata it is either -66.66 or 66.66. Having
> performed a manual calculation of the CCI with the underlying data
> from tblox, worked just fine.
Well then, your CCI function is broken.
Fix that *first* and apply it to your market data before trying to
insert the indicator it into a strategy.
All that applyIndicators (as called by applyStrategy) does is call your
indicator function and pass it your market data. You can and should
test your indicator function outside of quantstrat to make sur ethat you
can apply it to market data before trying to incorporate it into a
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
nrow(IBM) == nrow(CCI(HLC(IBM)))
add.indicator(strategy = 'test', name = "CCI", arguments = list(HLC =
applyIndicators('test',mktdata=IBM)$CCI == CCI(HLC(IBM))
# TRUE for every row