MACD Indicator: Settings, Crossovers, Histogram & Divergence
MACD (Moving Average Convergence Divergence) shows trend direction and momentum in a single pane. This guide explains how the MACD line, signal line and histogram are calculated, what the 12/26/9 settings mean, how to read crossovers and divergence, and how to turn MACD into stock screener filters.
What Is MACD?
MACD was developed by Gerald Appel in the late 1970s; the histogram was added later by Thomas Aspray. It tracks the relationship between two exponential moving averages (EMAs) of price. The name describes what it measures: when the fast and slow averages move toward each other they converge, and when they pull apart they diverge.
Unlike the RSI, which is bounded between 0 and 100, MACD has no fixed upper or lower limits. It oscillates around a zero line, and its values are in price units, so a $500 stock will show much larger MACD readings than a $20 stock. That's why MACD readings are compared with the stock's own history and with the signal line, not with a universal threshold.
💡 Two Indicators in One
MACD combines trend-following (the moving averages) with momentum (the speed at which the gap between them changes). That's why it appears in almost every charting platform and stock screener. For a side-by-side with RSI, see RSI vs MACD.
The Three Components of MACD
12 EMA − 26 EMA
The fast line. Positive when the short EMA is above the long EMA.
9 EMA of the MACD line
A smoothed version of MACD used for crossovers.
MACD − Signal
Bars showing the gap between the two lines.
MACD = EMA(12) − EMA(26)
Signal = EMA(9) of MACD
Histogram = MACD − Signal
All three are typically calculated on closing prices.
Hypothetical example: if a stock's 12-day EMA is $102.40 and its 26-day EMA is $100.90, the MACD line is +1.50. If the 9-day EMA of recent MACD values is +1.10, the histogram bar is +0.40: MACD is above zero (short-term trend up) and above its signal line (momentum still improving).
MACD Settings: 12, 26, 9 and Alternatives
The default 12, 26, 9 dates from an era of six-day trading weeks (12 days ≈ two weeks, 26 ≈ a month), but it has stuck because nearly every platform and screener uses it. Sticking with the default means your readings match what other traders and your screener see.
| Setting | Character | Typical use |
|---|---|---|
| 12, 26, 9 | Standard balance of speed and smoothness | Daily charts, swing trading, screeners |
| 8, 17, 9 | Faster, more signals, more noise | Shorter swings, active traders |
| 5, 35, 5 | Very responsive signal line | Spotting momentum shifts early |
| 19, 39, 9 | Slower, fewer whipsaws | Longer-term trend following |
| 12, 26, 9 on weekly bars | Smooths daily noise | Position trading, trend context |
Changing the timeframe often matters more than changing the numbers: a 12/26/9 MACD on a weekly chart behaves like a much slower indicator than the same setting on a 15-minute chart. Whatever you choose, test it on historical charts before relying on it.
The Zero Line and Trend Direction
MACD Above Zero
When the MACD line is above zero, the 12 EMA is above the 26 EMA, which usually means price has been rising over the past few weeks. The further above zero, the stronger the recent upward momentum relative to the stock's normal range.
MACD Below Zero
Below zero, the 12 EMA is under the 26 EMA, consistent with a short-term downtrend. Deep negative readings reflect strong downward momentum, not necessarily an "oversold" stock that must bounce.
Zero-Line Crosses
A cross above zero is mathematically the same event as the 12 EMA crossing above the 26 EMA. It's slower than a signal-line crossover, so it confirms a trend change rather than catching the turn. Many trend followers treat "MACD above zero" as a context filter: they only look for bullish setups when it's true.
MACD Crossover Signals
Bullish Crossover
The MACD line crosses above the signal line and the histogram flips from negative to positive. Momentum is improving. Crossovers that occur below zero can mark the early stage of a recovery, while crossovers above zero often signal the resumption of an existing uptrend after a pullback.
Bearish Crossover
The MACD line crosses below the signal line. Momentum is fading. A bearish crossover far above zero after an extended rally can warn that the advance is tiring.
Example Crossover Framework (Educational)
- Trend context: price above the 200-day moving average
- Signal: MACD crosses above the signal line, ideally after a pullback toward support or the 50-day MA
- Confirmation: the crossover day closes in the upper half of its range on at least average volume
- Risk: define a stop below the recent swing low; size the position so a stop-out is a small loss
- Exit plan: a bearish crossover, a close below the swing low, or a target near resistance
⚠️ Whipsaws in Sideways Markets
When price moves sideways, the two EMAs sit close together and MACD hovers near zero, producing frequent crossovers in both directions. A trend-strength filter such as ADX above 20–25 is one way to skip crossovers in trendless conditions.
Reading the MACD Histogram
The histogram measures the distance between MACD and its signal line, so it shows whether momentum is accelerating or decelerating. Because the signal line is an average of MACD, the histogram reaches zero exactly when a crossover happens; it typically starts shrinking several bars before that.
- Positive and growing: upward momentum is accelerating
- Positive but shrinking: still bullish, but momentum is slowing
- Negative and growing in size: downward momentum is accelerating
- Negative but shrinking: selling momentum is easing
A common technique is to watch for the first histogram bar that is smaller than the previous one after an extended run. It isn't a reversal signal on its own; it simply tells you the move is losing speed, which is useful when managing an open position.
MACD Divergence
Divergence occurs when price and MACD disagree, which suggests the momentum behind the trend is weakening.
Bullish Divergence
Price makes a lower low while MACD (or the histogram) makes a higher low. Sellers pushed price lower, but with less force than before.
Bearish Divergence
Price makes a higher high while MACD makes a lower high. The rally is continuing on fading momentum.
🎯 Hidden Divergence
Hidden divergence points to continuation: in an uptrend, price makes a higher low while MACD makes a lower low, suggesting the pullback was a pause rather than a reversal. The bearish version is a lower high in price with a higher high in MACD.
Divergences can persist for a long time in strong trends, so wait for price to confirm, for example a break of a trendline or a close back above a support or resistance level, before acting on one.
MACD Strategies
1. MACD + RSI Confirmation
A bullish MACD crossover carries more weight when RSI(14) is rising through 50 rather than already above 70. Conversely, a bearish crossover alongside RSI falling below 50 confirms weakening momentum. Because both indicators are derived from price, treat them as two views of the same data rather than independent evidence.
2. MACD + Moving-Average Trend Filter
Only take bullish signals when price is above the 200-day moving average, and only bearish ones below it. This simple filter removes many counter-trend crossovers.
3. Multi-Timeframe MACD
Use the weekly MACD for direction (above zero or above its signal line) and the daily MACD for timing. A daily bullish crossover while the weekly MACD is rising is aligned with the bigger trend.
4. MACD + Volatility Context
Crossovers that coincide with a breakout from a tight Bollinger Band squeeze or rising ATR often mark the start of a larger move, while crossovers inside a narrow, quiet range tend to fizzle. Use ATR to set stops that reflect the stock's normal daily movement.
MACD Screener Filters
Most screeners, including the free Tockmarket stock screener powered by TradingView, can filter on MACD values. These combinations are educational starting points, not recommendations:
| Goal | Example filters |
|---|---|
| Bullish momentum in an uptrend | MACD level > MACD signal, MACD > 0, price > 200-day SMA |
| Early recovery | MACD crosses above signal while MACD < 0, RSI(14) rising above 40 |
| Trend resumption after a pullback | MACD > 0, fresh bullish crossover, price within 3% of 50-day SMA |
| Momentum with participation | MACD > signal, relative volume > 1.5, average volume > 500K |
| Weakening leaders (watch list) | Price > 50-day SMA, MACD < signal, MACD still > 0 |
Always add liquidity filters (price, average volume, market cap) so the list is tradable. For full recipes that combine MACD with trend, volume and fundamental filters, see stock screener criteria.
Common MACD Mistakes
Comparing MACD values across stocks
MACD is in price units. A reading of 5 on a $400 stock is modest; on a $20 stock it would be extreme. Compare a stock's MACD with its own history.
Trading every crossover
In ranges, crossovers flip back and forth. Use a trend or trend-strength filter and wait for price confirmation.
Treating divergence as a timing signal
Divergence says momentum is fading, not when price will turn. Wait for a structural break.
Over-optimizing settings
Settings tuned to fit one stock's past often fail going forward. The default is a sensible baseline.
Frequently Asked Questions
What are the best MACD settings?
The default 12, 26, 9 (12- and 26-period EMAs with a 9-period signal line) is the most widely used and the one most screeners calculate. Faster settings such as 5, 35, 5 or 8, 17, 9 react sooner but give more false signals; slower settings such as 19, 39, 9 are smoother. No setting is best for every stock or timeframe.
What does it mean when MACD crosses above zero?
The MACD line crossing above zero means the 12-period EMA has moved above the 26-period EMA. It indicates short-term momentum has turned positive relative to the longer average. It is a slower, more trend-oriented signal than a signal-line crossover.
Is a MACD crossover a buy signal?
Not on its own. A bullish crossover only shows that short-term momentum is improving. In sideways markets crossovers whipsaw frequently, so traders usually combine them with a trend filter such as price above the 200-day moving average, volume, and support and resistance levels.
What does the MACD histogram show?
The histogram plots the MACD line minus the signal line. Bars above zero mean MACD is above its signal line; shrinking bars mean the gap is narrowing and momentum is slowing, which often happens before a crossover.
Is MACD a leading or lagging indicator?
MACD is built from moving averages, so it is fundamentally lagging. The histogram and divergences can turn before price does, which is why some traders treat them as early warnings, but they still confirm rather than predict.
Can I screen stocks by MACD?
Yes. Most screeners, including the TradingView screener, offer filters such as MACD level above the signal line, MACD above zero, or a recent MACD crossover. Combine them with liquidity filters like average volume and price so the results are tradable.
Key Takeaways
MACD = 12 EMA − 26 EMA; the signal line is a 9 EMA of MACD; the histogram is the gap between them.
Above zero means the short-term average leads the long-term one; zero-line crosses confirm trend changes.
Signal-line crossovers are faster but whipsaw in sideways markets; add a trend filter.
A shrinking histogram shows slowing momentum, often before a crossover.
In a screener, pair MACD filters with trend, volume and liquidity criteria.