Author: Andrey N. Bolkonsky
The Ergodic MACD Oscillator, crafted by William Blau, is an advanced tool detailed in his book "Momentum, Direction, and Divergence: Applying the Latest Momentum Indicators for Technical Analysis".
- To get started, make sure to place WilliamBlau.mqh in your terminal_data_folder\MQL5\Include\
- Then, drop Blau_Ergodic_MACD.mq5 into terminal_data_folder\MQL5\Indicators\

Erogdic MACD Oscillator by William Blau
How It Works:
The Ergodic MACD Oscillator is calculated using the following formula:
Ergodic_MACD(price,r,s,u) = MACD(price,r,s,u)
SignalLine(price,r,s,u,ul) = EMA( Ergodic_MACD(price,r,s,u) ,ul)
Where:
- Ergodic_MACD() - This represents the Ergodic MACD calculated with parameters (price, r, s, u);
- SignalLine() - The signal line is an exponentially smoothed moving average applied to the MACD.
Unlike the standard MACD, which uses a simple moving average, the Ergodic MACD employs an exponentially smoothed moving average, as proposed by William Blau.
Input Parameters:
- For the Ergodic plot (MACD):
- r - Period for the first EMA (slow), default is r=20;
- s - Period for the second EMA (fast), default is s=5;
- u - Period for the third EMA, default is u=3.
- For the Signal Line:
- ul - Smoothing period for the signal line, default is ul=3.
- AppliedPrice - Select the price type (default: PRICE_CLOSE).
Important Notes:
- Ensure r > 1 and s > 1;
- Keep in mind that s < r (William Blau advises this, but there's no code check);
- u > 0. If u = 1, no smoothing is applied;
- ul > 0. If ul = 1, the signal and ergodic lines will be identical;
- Minimum rates = ([max(r,s)] + u + ul - 3 + 1).
Related Posts
- Unlocking MetaCOT 2: Your Ultimate CFTC Indicator Toolkit for MT4
- Mastering the MACD Candle Indicator for MetaTrader 4
- Mastering the Open Range Breakout Indicator for MetaTrader 5
- Unlocking the Power of Master Tools for MetaTrader 4
- Unlock Trading Success with Custom MACD: Real-Time Alerts for Your Phone