Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 4 Indicators | Commodity Channel Index, CCI | MQL5 Code

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies.

Commodity Channel Index (CCI) indicator measures the deviation of the commodity price from its average statistical price.

High values of the index point out that the price is unusually high being compared with the average one, and low values show that the price is too low.

In spite of its name, the Commodity Channel Index can be applied for any financial instrument, and not only for the commodities.

Capture price channel breakouts with the Price Channel Expert Advisor. Precise entries and exits. Explore now.

Image for Commodity Channel Index, CCI

There are two basic techniques of using Commodity Channel Index:

  1. Finding the divergences
    The divergence appears when the price reaches a new maximum, and Commodity Channel Index can not grow above the previous maximums. This classical divergence is normally followed by the price correction.
  2. As an indicator of overbuying/overselling
    Commodity Channel Index usually varies in the range of ±100. Values above +100 inform about overbuying state (and about a probability of correcting decay), and the values below 100 inform about the overselling state (and about a probability of correcting increase).

Calculation:

  1. To find a Typical Price. You need to add the HIGH, the LOW, and the CLOSE prices of each bar and then divide the result by 3.

    TP = (HIGH + LOW +CLOSE)/3

  2. To calculate the n-period Simple Moving Average of typical prices.

    SMA(TP, N) = SUM[TP, N]/N

  3. To subtract the received SMA(TP, N) from Typical Prices.

    D = TP — SMA(TP, N)

  4. To calculate the n-period Simple Moving Average of absolute D values.

    SMA(D, N) = SUM[D, N]/N

  5. To multiply the received SMA(D, N) by 0,015.

    M = SMA(D, N) * 0,015

  6. To divide M by D

    CCI = M/D

where:

  • SMA — Simple Moving Average;
  • N — number of periods, used for calculation.

Technical Indicator Description

Full description of CCI is available in the Technical analysis: Commodity Channel Index

Thanks for reading. Discover premium MetaTrader solutions at RobotFX.

7769

Best MetaTrader Indicators + Profitable Expert Advisors