Technical Analysis  Technical Indicators  Oscillators  Moving Average Convergence/Divergence

Analyze with the

Moving Average Convergence/Divergence (MACD)

Moving Average Convergence/Divergence (MACD) is the next trend-following dynamic indicator. It indicates the correlation between two price moving averages.

The Moving Average Convergence/Divergence (MACD) Technical Indicator is the difference between a 26-period and 12-period Exponential Moving Average (EMA). In order to clearly show buy/sell opportunities, a so-called signal line (9-period indicators` moving average) is plotted on the MACD chart.

The MACD proves most effective in wide-swinging trading markets. There are three popular ways to use the Moving Average Convergence/Divergence: crossovers, overbought/oversold conditions, and divergences.


The basic MACD trading rule is to sell when the MACD falls below its signal line. Similarly, a buy signal occurs when the Moving Average Convergence/Divergence rises above its signal line. It is also popular to buy/sell when the MACD goes above/below zero.

Overbought/oversold conditions

The MACD is also useful as an overbought/oversold indicator. When the shorter moving average pulls away dramatically from the longer moving average (i.e., the MACD rises), it is likely that the security price is overextending and will soon return to more realistic levels.


An indication that an end to the current trend may be near occurs when the MACD diverges from the security. A bullish divergence occurs when the Moving Average Convergence/Divergence indicator is making new highs while prices fail to reach new highs. A bearish divergence occurs when the MACD is making new lows while prices fail to reach new lows. Both of these divergences are most significant when they occur at relatively overbought/oversold levels.

Calculation of MACD

The MACD is calculated by subtracting the value of a 26-period exponential moving average from a 12-period exponential moving average. A 9-period dotted simple moving average of the MACD (the signal line) is then plotted on top of the MACD.


EMA — the Exponential Moving Average;
SMA — the Simple Moving Average;
SIGNAL — the signal line of the indicator.

Moving Average of Oscillator

Moving Average of Oscillator is the difference between the oscillator and oscillator smoothing. In this case, Moving Average Convergence/Divergence base-line is used as the oscillator, and the signal line is used as the smoothing.


Source Code

Full MQL4 source of Momentum is available in the Code Base: Momentum

Warning: All rights on these materials are reserved by MetaQuotes Software Corp. Copying or reprinting of these materials in whole or in part is prohibited.