The Commodity Channel Index (CCI), developed by Donald Lambert, is a versatile momentum oscillator that measures the current price level relative to an average price level. It is widely used to identify overbought/oversold conditions and cyclical turns.
- **`CCI_Pro.mq5`**: The main indicator. It plots the CCI line, a configurable moving average signal line, and optional **Bollinger Bands** calculated on the CCI itself.
- **`CCI_Oscillator_Pro.mq5`**: Displays the difference between the CCI and its signal line as a histogram, providing a clear visual of momentum acceleration/deceleration.
- **`CCI_PercentB_Pro.mq5`**: A %B oscillator that shows the CCI's position relative to its Bollinger Bands, scaled from 0 to 100.
- **Self-Contained Calculators:** Each indicator in the suite (`CCI_Pro`, `CCI_Oscillator_Pro`, `CCI_PercentB_Pro`) uses its own dedicated, self-contained calculator. Each calculator contains the full, multi-stage logic required for its specific output. This approach prioritizes stability and clarity for each individual component.
- **Object-Oriented Inheritance:** Within each calculator, an elegant inheritance model (`...Calculator` and `...Calculator_HA`) is used. The Heikin Ashi child class inherits all the complex logic from its base class and only overrides the initial data preparation step.
- **Mathematically Precise Implementation:** The engine adheres strictly to the mathematical definition of CCI, using a nested loop structure to calculate the Mean Absolute Deviation (MAD) precisely for each bar.
- **CCI Period (`InpCCIPeriod`):** The lookback period for the base CCI calculation.
- **Applied Price (`InpSourcePrice`):** The source price for the base CCI. This unified dropdown allows selection from all standard and Heikin Ashi price types.
- **Overlay Settings:**
- **Display Mode (`InpDisplayMode`):** (Only for `CCI_Pro`) Toggles between `CCI_Only`, `CCI_and_MA`, and `CCI_and_Bands`.
- **MA Period (`InpMAPeriod`):** The period for the signal line, which also serves as the center for the Bollinger Bands.
- **MA Method (`InpMAMethod`):** The type of moving average for the signal line.
- **Bands Period (`InpBandsPeriod`):** The lookback period for the standard deviation calculation of the Bollinger Bands.
- **Bands Deviation (`InpBandsDev`):** The standard deviation multiplier for the Bollinger Bands.
- **Overbought/Oversold:** Readings above +100 and below -100.
- **Crossovers:** CCI line crossing its signal line.
- **Bollinger Bands:** The bands show the volatility *of the CCI itself*. A "squeeze" on the CCI bands can foreshadow a significant breakout in price momentum.
- **`CCI_Oscillator_Pro`:**
- Visualizes the momentum of the CCI relative to its signal line. A zero-line cross confirms a signal line crossover on the `CCI_Pro`. Growing bars indicate accelerating momentum, while shrinking bars indicate decelerating momentum.
- **`CCI_PercentB_Pro`:**
- **Overbought/Oversold:** Provides a normalized (0-100) view of overbought/oversold conditions. Readings above 80-100 or below 0-20 are significant.
- **"Headroom":** Shows how much "room" the CCI has to move before it becomes extreme relative to its own recent volatility.