TrendExpert Curated · Playbook

MACD

Moving Average Convergence Divergence

A trend-momentum indicator built from the difference between two EMAs, plus a signal line and histogram that visualise momentum shifts.

MACD is a trend-momentum indicator built from the difference between a 12-bar and 26-bar EMA, plus a 9-bar signal line and a histogram. The signal-line cross marks momentum shifts; the zero line marks the trend regime. Default settings: 12, 26, 9.

MACD is the difference between a fast EMA (default 12) and a slow EMA (default 26). A third EMA of that difference (default 9) becomes the signal line, and the gap between MACD and signal is plotted as a histogram.

The three classic reading lenses are: the MACD/signal cross (momentum shift), the zero-line position (regime: above zero bullish, below zero bearish), and the histogram slope (acceleration or deceleration of momentum). MACD behaves poorly in choppy markets because the EMAs whip around — pair it with a regime filter for usable results.

Entry ideas

How do I enter trades using MACD?

03ideas
01Entry idea

Signal line cross up

The textbook MACD long trigger, filtered for quality by the zero-line regime.

02Entry idea

Zero-line cross

A slower regime-change long that catches larger, cleaner trends with fewer false starts.

03Entry idea

Histogram early reversal

An aggressive early-entry long that buys the first sign of momentum reclamation.

Exit ideas

When should I exit an MACD trade?

03ideas
01Exit idea

Signal line cross down

A symmetrical momentum-flip exit that mirrors the classic MACD entry trigger.

02Exit idea

Zero-line cross exit

A patient exit that lets winners run until the whole trend regime flips.

03Exit idea

Histogram peak exit

An early exit that locks gains when momentum starts fading at the top.

Utilities

What else is MACD good for?

02ideas
01Utility

Trend-regime filter

A cheap bias filter that keeps any directional system on the right side of the prevailing trend.

02Utility

Higher-timeframe bias

A higher-timeframe trend filter that keeps entries aligned with the daily MACD regime.

How do I read MACD?

  • MACD line above zero = the fast EMA is above the slow EMA = the recent trend regime is bullish.
  • MACD line below zero = bearish regime.
  • MACD crosses above signal line = momentum shifting bullish (long trigger). Cross below = bearish trigger.
  • Histogram growing positive = bullish momentum accelerating. Histogram shrinking = momentum weakening, often before a cross fires.
  • Bearish divergence: price makes a higher high but MACD makes a lower high — signals weakening upside momentum.

What are the default MACD settings?

ParameterDefaultWhen to adjust
Fast EMA length12Gerald Appel's original setting. Drop to 8 for faster signals on crypto/intraday; raise to 19 for less noise on weekly charts.
Slow EMA length26Original setting. Keep paired with fast EMA at roughly 2× the fast length.
Signal length9EMA smoothing of the MACD line. Tighter (5) gives earlier signals with more whipsaws; wider (14) is smoother but later.
SourceCloseMost common. HLC3 produces smoother readings on volatile assets.

How do I code MACD in Pine Script?

//@version=5
indicator("MACD Example", overlay=false)

fastLen   = input.int(12, title="Fast Length",   minval=1)
slowLen   = input.int(26, title="Slow Length",   minval=1)
signalLen = input.int(9,  title="Signal Length", minval=1)
src       = input.source(close, title="Source")

[macdLine, signalLine, hist] = ta.macd(src, fastLen, slowLen, signalLen)

plot(macdLine,   title="MACD",      color=color.blue)
plot(signalLine, title="Signal",    color=color.orange)
plot(hist,       title="Histogram", color=hist >= 0 ? color.green : color.red, style=plot.style_columns)
hline(0, "Zero", color=color.gray)

Pine's ta.macd() returns three values in one call: the MACD line, signal line, and histogram. Plotting the histogram as columns (green when positive, red when negative) makes momentum acceleration visually obvious. Wire all three lengths to inputs so users can tune without touching code. The hline at zero anchors the regime read at a glance.

How is MACD calculated?

MACD measures the relationship between two exponential moving averages of different lengths, then smooths that relationship into a signal line and visualises the gap as a histogram.

  1. 1.Compute a 12-bar exponential moving average (EMA) of close — the fast EMA.
  2. 2.Compute a 26-bar EMA of close — the slow EMA.
  3. 3.Subtract slow from fast: MACD line = EMA(12) − EMA(26).
  4. 4.Compute a 9-bar EMA of the MACD line — the signal line.
  5. 5.Plot the histogram: MACD line − signal line. Above zero = bullish momentum, below = bearish.

When does MACD fail?

MACD is a trend-momentum indicator — its strength is catching directional moves and signalling fading momentum. It fails reliably in three regimes.

Choppy ranges are the most common failure: when price oscillates within a band, the MACD line whips across the signal line, generating false trigger after false trigger. Each cross looks valid in isolation; in aggregate they bleed accounts.

Low-volatility, gentle drifts produce histogram readings near zero with no acceleration — there is no edge to trade because there is no sustained momentum to confirm.

Trend-rotation periods (when one trend dies and another struggles to start) produce ambiguous signals, with the MACD line dancing around zero.

Pair MACD with a regime filter (ADX above 20, range-detection logic, or Bollinger Band squeeze) to gate when its signals are trade-worthy.

What mistakes do traders make with MACD?

  • Trading every signal-line cross. In choppy markets MACD whipsaws constantly. Filter crosses by requiring the MACD line to be on the trend-aligned side of zero (above for longs, below for shorts).
  • Ignoring the zero-line context. A signal cross deep below zero is fundamentally different from one above zero. The position relative to zero is the regime; the cross is just timing.
  • Treating histogram divergence as a guarantee. Divergence between price and histogram signals weakening momentum but does not pinpoint reversal timing. Wait for confirmation — a swing point break or candle pattern.
  • Tuning the 12/26/9 settings to fit one market. Appel's defaults work across a remarkably wide range of assets and timeframes. Custom settings often overfit one backtest period and fail out-of-sample.
  • Using MACD on a flat chart and being surprised by losses. Always check the bigger picture (ADX, range detection, eyeballed structure) before taking MACD signals.

How does MACD compare to similar tools?

IndicatorWhen to prefer
EMA crossoverA simple two-EMA crossover gives the same regime info without the signal-line layer; cleaner for pure trend-following systems.
RSIRSI is bounded 0–100 and better at flagging overbought/oversold extremes; MACD is unbounded and better at trend strength.
SupertrendSupertrend gives a single binary regime read with built-in volatility-adjusted stops; MACD gives more nuance but requires interpretation.

MACD FAQ

What's the difference between the MACD line and the signal line?

The MACD line is the difference between two EMAs (default 12 and 26 bars), reflecting the gap between fast and slow trend speeds. The signal line is a 9-bar EMA of the MACD line — a smoothed version that lags slightly. Crosses between the two are the timing signal; the MACD line itself shows the underlying trend regime.

Are MACD's 12/26/9 settings still optimal?

Gerald Appel's original 12/26/9 settings, designed in the 1970s for daily stock charts, remain the de facto standard across stocks, forex, and crypto. They balance responsiveness against noise. Tune only when you have out-of-sample data showing a different setting holds up — most custom tunings overfit single backtest windows.

Why does MACD fail in ranging markets?

MACD measures the gap between two EMAs. In a range, both EMAs converge toward the mean and the MACD line oscillates around zero, producing constant signal-line crosses with no follow-through. Pair with a regime filter (ADX above 20, Bollinger squeeze) so you only trade its crosses when the market is actually trending.

Should I use MACD or RSI?

Use MACD for trend-following: it tells you which side of the market to be on (zero-line position) and times momentum shifts (signal-line cross). Use RSI for mean-reversion: it flags stretched extremes and momentum divergences. Many systems combine both — MACD for direction, RSI for entry timing within that direction.

Continue exploring

Related indicators in the Playbook

Browse all 8 indicators

About these ideas

Each entry, exit, and utility rule in the Playbook is hand-picked from established trading literature, validated against historical backtests, and reviewed by the PineWiz team. We add new ideas as we encounter them and refresh existing ones when market behavior or default settings shift. Last review: .

Educational content. Not financial advice.