Setting Up MACD for Expert Analysis

In this article

Setting Up Moving Average Convergence Divergence (MACD) for Expert Analysis

MACD (moving average convergence divergence) is a momentum indicator equal to a stock's 12-day exponential moving average (EMA) minus its 26-day EMA. A 9-day EMA of the MACD line is plotted as the signal line, and the histogram shows the gap between the two. The standard setup is therefore 12, 26, 9. When MACD crosses above the signal line, momentum is turning up (a bullish crossover); when it crosses below, momentum is turning down (a bearish crossover).

Setting Up MACD for Expert Analysis - technical indicators and chart patterns in Excel with MarketXLS

What is MACD?

MACD is a technical indicator used on stocks, ETFs, forex and other markets to show the direction and strength of a trend. Because it is built from two moving averages, it follows the trend but reacts faster than a simple moving average crossover.

How MACD is calculated

  1. MACD line = 12-day EMA − 26-day EMA of closing prices.
  2. Signal line = 9-day EMA of the MACD line.
  3. Histogram = MACD line − signal line.

MACD above zero means the shorter-term average is above the longer-term one, a sign of upward momentum; below zero signals downward momentum.

How to set up MACD

Most charting platforms offer MACD with the default 12, 26, 9 settings, and those are the usual starting point. Shorter settings (for example 5, 35, 5) react faster but give more false signals; longer settings are smoother but slower. Test any change on the stocks and timeframe you trade before relying on it.

How to interpret MACD signals

  • Signal-line crossovers: MACD crossing above the signal line is a bullish crossover; crossing below is bearish.
  • Zero-line crossovers: MACD moving above zero confirms upward momentum; moving below zero confirms downward momentum.
  • Divergence: price making a new high while MACD makes a lower high can warn that momentum is fading.

MACD lags price and gives false signals in sideways markets, so confirm it with other tools, such as volume-based indicators like On-Balance Volume (OBV), and with price trend.

How to calculate MACD in Excel with MarketXLS

MarketXLS returns exponential moving averages as Excel formulas, so the MACD line is one cell: =ExponentialMovingAverage("AAPL", 12) - ExponentialMovingAverage("AAPL", 26). MarketXLS also provides a generic indicator function, =TechnicalIndicator("AAPL", "MACD"). Copy the formulas down a list of tickers to screen for stocks with MACD above zero. See MarketXLS technical indicators for the full list.

Conclusion

MACD compares a 12-day and 26-day EMA to show momentum, with a 9-day signal line for crossovers. Use the default 12, 26, 9 settings as a baseline, confirm signals with volume and trend, and do not trade on MACD alone. This article is educational and not investment advice.

Browse the MarketXLS templates library for technical analysis models.

Relevant blogs that you can read to learn more about the topic

What is the MACD Indicator and How Can it Help You Trade?
On Balance Volume (Formula In Excel)
Marketxls New Release Version 9.2
Technical Indicators – Meaning & Application
Technical Indicators For Swing Traders (Using Marketxls)

About the authors
Anagh

About Anagh

CTO, MarketXLS

Anagh is the CTO of MarketXLS. He works with Ankur and Robin on the MarketXLS blog, creating articles together about market data and spreadsheet workflows.

Written collaboratively by Anagh, Ankur and Robin.

Important Disclaimer

The information provided in this article is for educational and informational purposes only and should not be construed as investment advice, a recommendation, or an offer to buy or sell any securities. MarketXLS is a financial data platform and is not a registered investment advisor, broker-dealer, or financial planner. Always conduct your own research and consult with a qualified financial professional before making any investment decisions. Past performance is not indicative of future results. Trading and investing involve substantial risk of loss.

Explore MarketXLS in Excel
Download a free sample workbook (.xlsx). MarketXLS is a paid subscription.
I agree to the MarketXLS Terms and Conditions

See MarketXLS in action

Bring this workflow into Excel.

Book a demo with our team to see how MarketXLS supports your market research.

Ankur
AnkurFounder & CEO, MarketXLS
Book a demo