[R-SIG-Finance] Need help for calculating 9 period cci
Bharat Kherwa
bharatram.mnit at gmail.com
Tue Sep 20 06:35:08 CEST 2011
Hello All
I need some help regarding calculating 9 period cci,
I did it this way:
>library(TTR)
>data(ttrc)
>cci <- CCI(ttrc[,c("High","Low","Close")] , ma = list("SMA", n=20), c=0.015))
Error in do.call(maType, c(list(HLC), maArgs)) :
'what' must be a character string or a function,
Then I tried calculating ma first: this way:
>ma<-SMA(ttrc[, "Close"], 9);
>cci <- CCI(ttrc[9:nrow(ttrc),c("High","Low","Close")] , ma, c=0.015);
Error in if (n < 1 || n > NROW(x)) stop("Invalid 'n'") :
missing value where TRUE/FALSE needed
Please let me know how to do this,
any help will be greatly appreciated,
thanks a lot
Bharat
More information about the R-SIG-Finance
mailing list