The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Finance::GeniusTrader::Indicators::CCI

Overview

Developed by Donald Lambert, the Commodity Channel Index (CCI) was designed to identify cyclical turns in commodities. The assumption behind the indicator is that commodities (or stocks or bonds) move in cycles, with highs and lows coming at periodic intervals.

Calculation

There are 4 steps involved in the calculation of the CCI : 1. Calculate the last period's Typical Price (TP) = (H+L+C)/3 where H = high, L = low, and C = close. 2. Calculate the 20-period Simple Moving Average of the Typical Price (SMATP). 3. Calculate the Mean Deviation. First, calculate the absolute value of the difference between the last period's SMATP and the typical price for each of the past 20 periods. Add all of these absolute values together and divide by 20 to find the Mean Deviation. 4. The final step is to apply the Typical Price (TP), the Simple Moving Average of the Typical Price (SMATP), the Mean Deviation and a Constant (.015) to the following formula :

CCI = ( (Typical Price - Simple Moving Average of the Typical Price) / (0.015 * Mean Deviation))

Parameters

Lambert recommended using 1/3 of a complete cycle (low to low or high to high) as a time frame for the CCI. Note that the determination of the cycle's length is independent of the CCI. If the cycle runs 60 days (a low about every 60 days), then a 20-day CCI would be recommended.

Example

Finance::GeniusTrader::Indicators::CCI->new() Finance::GeniusTrader::Indicators::CCI->new([25])

Note

Traders and investors use the CCI to help identify price reversals, price extremes and trend strength. As with most indicators, the CCI should be used in conjunction with other aspects of technical analysis. CCI fits into the momentum category of oscillators.

Validation

This Indicator was validated by the data available from comdirect.de: The DAX at 04.06.2003 (data from yahoo.com) had a CCI of 158.71 This is consistent with this indicator: 158.7057

http://www.equis.com/free/taaz/cci.html http://www.stockcharts.com/education/What/IndicatorAnalysis/indic_CCI.html http://www.finance-net.com/apprendre/techniques/cci.phtml

Finance::GeniusTrader::Indicators::CCI::calculate($calc, $day)