What Is the Moving Average Convergence Divergence?

The moving average convergence divergence (MACD) is a technical momentum indicator, calculated for use with a variety of exponential moving averages (EMAs) and used to assess the power of price movement in a market.

There are a number of calculations involved in the creation of the total (MACD) indicator, all involving the use of exponential moving averages.

An EMA is calculated as follows:

  • Calculate the simple moving average (SMA) for the chosen number of time periods. (The EMA uses an SMA as the previous period's EMA to start its calculations.) To calculate a 12-period EMA, this would simply be the sum of the last 12 time periods, divided by 12.
  • Calculate the weighting multiplier using this equation:
    212+1=0.1538\frac{2}{12+1}= 0.153812+12=0.1538

Calculate the 12 EMA itself as:
(CloseEMAprevious period)0.1538+EMAprevious period\left(Close - EMA_{previous~period}\right)* 0.1538 + EMA_{previous~period}(CloseEMAprevious period)0.1538+EMAprevious period

Putting together the MACD requires simply doing all of the following EMA calculations for any given market instrument (a stock, future, currency pair, or market index):

  1. Calculate a 12-period EMA of the price for the chosen time period.
  2. Calculate a 26-period EMA of the price for the chosen time period.
  3. Subtract the 26-period EMA from the 12-period EMA.
  4. Calculate a nine-period EMA of the result obtained from step 3.

This nine-period EMA line is overlaid on a histogram that is created by subtracting the nine-period EMA from the result in step 3, which is called the MACD line, but it is not always visibly plotted on the MACD representation on a chart.

The MACD also has a zero line to indicate positive and negative values. The MACD has a positive value whenever the 12-period EMA is above the 26-period EMA and a negative value when the 12-period EMA is below the 26-period EMA.