• General
• Personal Finance
• Reviews & Ratings
• Wealth Management
• Popular Courses
• Courses by Topic

How to Calculate Moving Average Convergence Divergence (MACD)

What Is the Moving Average Convergence Divergence (MACD)?

The moving average convergence divergence (MACD) is a popular 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.

Key Takeaways

• Moving Average Convergence Divergence (MACD) is calculated by subtracting the 26-period exponential moving average (EMA) from the 12-period EMA.
• MACD triggers technical signals when it crosses above (to buy) or below (to sell) its signal line.
• The speed of crossovers is also taken as a signal of a market is overbought or oversold.
• MACD helps investors understand whether the bullish or bearish movement in the price is strengthening or weakening.

Calculating MACD

There are several 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.

Weight Multiplier = K = 2/(n+1) where n = period

• Calculate the weighting multiplier using this equation:
$\frac{2}{12+1}= 0.1538$

Calculate the 12 EMA sequentially as:
$\left(Close - EMA_{previous~period}\right)* 0.1538 + EMA_{previous~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 to create the MACD line.
4. Calculate a nine-period EMA of the MACD line (the result obtained from step 3) to create the signal line.
5. Subtract the signal line from the MACD line to create the histogram.

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 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.

The Bottom Line

The MACD uses exponential moving averages in sequence to produce a popular indicator of momentum, which allows technical traders to spot trends and reversals.

Take the Next Step to Invest
×
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.
Service
Name
Description