How to Calculate Moving Average Convergence Divergence (MACD)

Investing News

What Is the Moving Average Convergence Divergence?

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:

    2 12 + 1 = 0.1538 frac{2}{12+1}= 0.1538
    12+12=0.1538

Calculate the 12 EMA sequentially as:

( C l o s e E M A p r e v i o u s   p e r i o d ) 0.1538 + E M A p r e v i o u s   p e r i o d 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 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.

Articles You May Like

Data centers powering artificial intelligence could use more electricity than entire cities
5 Moonshot Stocks to Buy for 2025 
Quantum Computing: The Key to Unlocking AI’s Full Potential?
Activist Ananym has a list of suggestions for Henry Schein. How the firm can help improve profits
Autonomous Vehicles: Why 2025 Will Usher in the Self-Driving Car