CCI

Category: Indicators

The Commodity Channel Index (CCI) is a versatile technical indicator used to identify new trends or warn of extreme conditions in the market. It measures the variation of a security’s price from its statistical mean, helping traders to assess the strength of price movements.

Syntax:

CCI[N](price)

The function takes two parameters:

  • N: The number of periods over which the CCI is calculated.
  • price: The price type to be used in the calculation. This is typically the typical price (average of high, low, and close), but can be any price representation.

Calculation:

The CCI is calculated using the following formula:
CCI = (Price - MM) / (0.015 * D)

  • Price: The typical price, calculated as (High + Low + Close) / 3.
  • MM: The simple moving average (SMA) of the price over N periods.
  • D: The mean absolute deviation of the typical price over N periods.

Interpretation:

The CCI indicator is primarily used to spot overbought and oversold conditions in the market:

  • Values above +100 suggest an overbought condition, indicating a potential price reversal or pullback.
  • Values below -100 indicate an oversold condition, suggesting a possible upward price correction.

Example:

myCCI = CCI[20](close)
SIGNAL = 0
IF myCCI < -100 THEN SIGNAL = -1 ENDIF IF myCCI > 100 THEN
  SIGNAL = 1
ENDIF
RETURN SIGNAL

This example calculates the CCI over 20 periods using the closing price. It then sets a signal based on the CCI value: -1 for oversold conditions and +1 for overbought conditions.

The CCI is a useful tool for traders to gauge the momentum and potential reversal points in the market, based on how far prices have deviated from their moving average.

Related Instructions:

  • DivergenceCCI indicators
  • Logo Logo
    Loading...