[R-SIG-Finance] Need help for calculating 9 period cci

Bharat Kherwa bharatram.mnit at gmail.com
Tue Sep 20 06:57:46 CEST 2011


great, thanks a lot!!!

2011/9/19 Daniel Cegiełka <daniel.cegielka at gmail.com>:
>> getSymbols('RHT')
>> CCI(cbind(Hi(RHT), Lo(RHT), Cl(RHT)),n=20,ma="SMA",c=0.015)
>
> best regards,
> daniel
>
>
> 2011/9/20 Bharat Kherwa <bharatram.mnit at gmail.com>:
>> 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
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions should go.
>>
>



More information about the R-SIG-Finance mailing list