The Moving Average Convergence Divergence, or MACD, is a trend-following momentum indicator built from two exponential moving averages. It shows whether short-term momentum is stronger or weaker than longer-term momentum, and whether that gap is widening or narrowing.
This article explains how the MACD indicator is calculated, works through an example, explains the signal line, histogram and zero line, covers crossovers and divergences, and sets out why it often confirms moves late.
The three parts
MACD was developed by Gerald Appel. The standard settings are 12, 26 and 9.
The MACD line = 12-period exponential moving average (EMA) − 26-period EMA of closing prices.
The signal line = 9-period EMA of the MACD line.
The histogram = MACD line − signal line, drawn as bars above or below zero.
Worked example. Suppose a stock's 12-day EMA is 1,020 and its 26-day EMA is 1,005. The MACD line is 1,020 − 1,005 = 15. If the 9-day EMA of recent MACD values (the signal line) is 12, the histogram is 15 − 12 = 3.
A positive MACD means the shorter average is above the longer one: recent prices have been rising faster than the longer trend. A positive histogram means the MACD line is above its own average: that momentum is currently increasing.
Because MACD is measured in price units, values are not comparable between stocks with very different prices. A MACD of 15 means something different for a ₹100 stock and a ₹5,000 stock.
Crossovers
Signal-line crossovers. When the MACD line crosses above the signal line, the histogram turns positive; many traders read this as momentum turning up. A cross below is read as momentum turning down. These are the most frequent MACD signals, and the noisiest.
Zero-line crossovers. When the MACD line crosses above zero, the 12-period EMA has moved above the 26-period EMA, the classic moving average crossover in a different form. These happen less often and confirm a trend change later.
In strong, steady trends, crossovers in the direction of the trend tend to work better. In sideways markets, the MACD line weaves around the signal line and zero line, producing a series of small losing signals.
Reading the histogram
The histogram shows the distance between the MACD line and the signal line. It changes before a crossover happens, which makes it the earliest part of the indicator to react.
Shrinking positive bars mean upward momentum is fading even though MACD is still above its signal line.
Shrinking negative bars mean downward momentum is fading.
Some traders watch for the histogram to stop growing and turn, as an early warning that a crossover may follow. Earlier warnings come with more false alarms; there is always a trade-off between speed and reliability.
Divergences
A bearish divergence occurs when price makes a higher high while MACD or its histogram makes a lower high. A bullish divergence occurs when price makes a lower low while MACD makes a higher low.
As with other momentum indicators, divergences show weakening momentum, not a reversal. Strong trends can carry several divergences before turning, and many apparent divergences are only obvious in hindsight. Treating them as reasons to tighten risk, rather than to bet on reversals, is usually more sensible.
A worked crossover illustration
Illustrative only. A stock has drifted lower for several weeks. Its MACD line is −8 and the signal line −6, so the histogram is −2: momentum is negative and still slightly increasing to the downside.
Over the next few sessions the stock stabilises. The histogram shrinks to −1, then 0, as the MACD line catches up with the signal line. Then the MACD line rises to −4 while the signal line is −5: a bullish signal-line crossover, with the histogram at +1. Both lines are still below zero, so the longer trend has not yet turned.
A trader using MACD as a filter might note the improving momentum but wait for the MACD line to cross above zero, or for price to clear a recent resistance zone, before treating it as more than a pause in the decline. If the stock instead rolls over and the lines cross back down within days, that is the typical whipsaw of a signal-line crossover in a weak market.
The illustration shows the trade-off in practice: the earliest signal came from the histogram, the next from the crossover, and the most reliable but latest from the zero line.
Using MACD with futures and options
Apply it to the underlying. Calculate MACD on the stock, index or futures price, not on an option premium, which also moves with time decay and implied volatility.
Use it as a filter. A trader might only consider bullish structures when MACD is above zero on the daily chart, and use a shorter timeframe or price levels for timing.
Remember the lag when choosing expiry. Because MACD confirms moves after they start, a signal on a daily chart may arrive when part of the move is already priced. Very short-dated options leave little time for a lagging signal to pay off.
Define risk first. Size positions and set exits before acting on any indicator signal.
Limits and good habits
It lags. MACD is built from moving averages of moving averages; it describes momentum that has already appeared.
It repeats information. MACD, moving average crossovers and many momentum oscillators are mathematically related. Adding several of them gives the illusion of confirmation without new information.
Settings are not sacred. 12, 26 and 9 come from an era of six-day trading weeks. Changing them changes the signals; tuning them to fit past data is a common way to overfit.
Gaps and news override it. Results or policy announcements can move price far beyond what any indicator anticipated.
Test it on your instruments. Record signals, outcomes and costs over a meaningful sample before relying on them.
An account with advanced charting
Add MACD, averages and volatility indicators to any chart before you decide. Free to open
Figures are illustrations. This is educational material, not advice, and no stock, index or system is recommended. We run no tips group and no signal service, we manage nobody's money, and no return is promised. Derivatives can lose more than the amount blocked against them.
Disclosure: the account-opening link on this page is under Atul Shrivastava's Zerodha Authorised Person registration (NSE AP Reg: AP2516003481; Zerodha Broking Ltd. SEBI Reg: INZ000031633) and earns a revenue share. TheFinBaba is not a SEBI-registered Investment Adviser — this content is educational, not investment advice.
Frequently Asked Questions
What is the MACD indicator?
Moving Average Convergence Divergence: the difference between a 12-period and a 26-period exponential moving average, with a 9-period signal line and a histogram showing the gap between them.
How is MACD calculated?
MACD line = 12-period EMA minus 26-period EMA. Signal line = 9-period EMA of the MACD line. Histogram = MACD line minus signal line.
What does a MACD crossover mean?
A MACD line crossing above its signal line suggests momentum turning up; crossing below suggests it is turning down. These signals are frequent and noisy in sideways markets.
What does the MACD histogram show?
The gap between the MACD line and the signal line. Shrinking bars indicate fading momentum and often change before a crossover.
Is MACD a leading or lagging indicator?
Lagging. It is built from moving averages and confirms momentum after it has begun.
Related Reading
- Measuring volatility with ATR
- A trend line built from ATR
- RSI as a second momentum view
- The averages MACD is built from
- Trend setups held for days
- Writing indicator rules into a plan
Disclaimer: TheFinBaba provides educational content only - this is not investment advice. Trading involves risk of loss.