Author: Andrey N. Bolkonsky
The Ergodic CMI-Oscillator, rooted in the Candlestick Momentum Index, is a powerful tool introduced by William Blau in his insightful book, "Momentum, Direction, and Divergence: Applying the Latest Momentum Indicators for Technical Analysis".
- Make sure to place WilliamBlau.mqh in your terminal_data_folder\MQL5\Include\
- Drop Blau_CMI.mq5 into your terminal_data_folder\MQL5\Indicators\

Ergodic CMI-Oscillator by William Blau
Calculation Breakdown:
The Ergodic CMI-Oscillator is calculated as follows:
Ergodic_CMI(price1, price2, q, r, s, u) = CMI(price1, price2, q, r, s, u)
SignalLine(price1, price2, q, r, s, u, ul) = EMA(Ergodic_CMI(price1, price2, q, r, s, u), ul)
Where:
- Ergodic_CMI() - The Ergodic Candlestick Momentum Index CMI(price1, price2, q, r, s, u);
- SignalLine() - The Signal Line, which is an exponentially smoothed moving average EMA(ul), applied to the Ergodic;
- ul - The period of the signal line.
Input Parameters:
- Graphic Plot #0 - Ergodic (Candlestick Momentum Index):
- q - Number of bars used in the calculation of Candlestick Momentum (default is q=1);
- r - Period of the 1st EMA(r), applied to Candlestick Momentum (default is r=20);
- s - Period of the 2nd EMA(s), applied to the result of the 1st smoothing (default is s=5);
- u - Period of the 3rd EMA(u), applied to the result of the 2nd smoothing (default is u=3);
- Graphic Plot #1 - Signal Line:
- ul - Period of the Signal Line - EMA(ul), applied to Ergodic (default is ul=3);
- AppliedPrice1 - Price type (default is AppliedPrice1=PRICE_CLOSE);
- AppliedPrice2 - Price type (default is AppliedPrice2=PRICE_OPEN).
Important Notes:
- Ensure q>0;
- r>0, s>0, u>0. If r, s, or u equal 1, smoothing is not applied;
- ul>0. If ul=1, the signal and main lines will coincide;
- Minimum rates = (q-1+r+s+u+ul-4+1).
Related Posts
- Unlocking the Power of Master Tools for MetaTrader 4
- Unlocking the Candlestick Momentum Index (CMI) for MetaTrader 5
- Unlocking MetaCOT 2: Your Ultimate CFTC Indicator Toolkit for MT4
- Unlock Trading Insights with Volume Profile + Range v6.0 for MetaTrader 5
- Mastering the MACD Candle Indicator for MetaTrader 4