Technical Analysis · Trend Indicators

Complete MACD Indicator Guide
Real Uses of Golden/Death Crosses

2026-06-03·11 min read·Beginner ~ Intermediate

The MACD (Moving Average Convergence Divergence) was invented by Gerald Appel in 1979 and is the most classic trend-following indicator in technical analysis. Almost everyone has heard "buy the golden cross, sell the death cross," but looking at crosses alone gives roughly a 50% win rate — about the same as a coin flip. This post explains why and how to improve on it.

1. What Is MACD? What Do the Three Lines Do?

MACD has three components:

1. MACD line = EMA(12) − EMA(26)

The difference between the two moving averages. When the short EMA is above the long EMA, MACD > 0; otherwise < 0. It quickly reflects the relationship between short-term and long-term momentum.

2. Signal line = EMA(MACD, 9)

A 9-period EMA of the MACD line, which reacts a bit slower. Treat it as a "smoothed reference" for the MACD line.

3. Histogram = MACD − Signal

The difference between the two lines, shown as a histogram. A positive histogram (green bars) = MACD above Signal = bullish momentum; a negative one (red bars) = bearish momentum.

MACD 指標教學圖上方價格 K 線,下方為 MACD 雙線。MACD(藍)上穿 Signal(橙)為 黃金交叉,價格隨後上漲;下穿為死亡交叉,價格隨後下跌。價格(K 線)MACDMACD 線Signal 線🟢 黃金交叉🔴 死亡交叉
圖 2:MACD 黃金/死亡交叉,搭配價格走勢

2. Beginner Use: Golden / Death Cross

This is the textbook version:

  • Golden cross: MACD line crosses above the Signal line → buy
  • Death cross: MACD line crosses below the Signal line → sell
Why a pure cross strategy is roughly 50%
MACD is a lagging indicator — it's the difference between two moving averages, and by the time a cross fires, price has already moved. Chop is even worse: you can get three golden and three death crosses in a single day and stop out on every one.

Pine implementation (pure cross, for teaching):

pine
//@version=5
strategy("MACD Pure Cross (Teaching)", overlay=true)

[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)

if (ta.crossover(macdLine, signalLine))
    strategy.entry("Long", strategy.long)

if (ta.crossunder(macdLine, signalLine))
    strategy.entry("Short", strategy.short)

3. Intermediate Use: MACD + Zero-Line Filter

A golden cross occurring above the zero line (MACD > 0) means something different from one occurring below the zero line (MACD < 0):

  • Golden cross above zero: a pullback buy in an uptrend, higher win rate
  • Golden cross below zero: a weak bounce, often a false breakout
  • Bearish crosses are symmetric (more reliable below the zero line)
pine
//@version=5
strategy("MACD + Zero Line Filter", overlay=true)

[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)

// Only accept long cross above zero + short cross below zero
longSignal = ta.crossover(macdLine, signalLine) and macdLine > 0
shortSignal = ta.crossunder(macdLine, signalLine) and macdLine < 0

if (longSignal)
    strategy.entry("Long", strategy.long)
if (shortSignal)
    strategy.entry("Short", strategy.short)

4. Advanced Use: MACD Histogram Contraction

The histogram isn't just positive vs. negative — its absolute size reflects momentum strength. When red bars get consecutively shorter (negative values shrinking), bearish momentum is fading and a bounce may be near. This signals 1–2 bars earlier than a cross.

pine
//@version=5
indicator("Histogram Squeeze Detection", overlay=false)

[_, _, hist] = ta.macd(close, 12, 26, 9)

// 3 consecutive shrinking red bars → short momentum exhaustion
weakening_down = hist < 0 and hist > hist[1] and hist[1] > hist[2] and hist[2] > hist[3]

// 3 consecutive shrinking green bars → long momentum exhaustion
weakening_up = hist > 0 and hist < hist[1] and hist[1] < hist[2] and hist[2] < hist[3]

bgcolor(weakening_down ? color.new(color.green, 80) : na, title="Long Warning")
bgcolor(weakening_up ? color.new(color.red, 80) : na, title="Short Warning")

5. Pro Use: MACD Divergence

Like RSI, MACD also has divergence signals:

  • Price makes a new high, MACD does not → bearish divergence
  • Price makes a new low, MACD does not → bullish divergence

MACD divergence works on the same principle as RSI divergence, but MACD divergence usually shows up earlier (because MACD reacts more sensitively to short-term momentum). You can watch both and use them as cross-confirmation.

How to detect divergence automatically
Pine ships with ta.pivothigh and ta.pivotlow for finding local highs and lows. Comparing the direction of price pivots against MACD pivots is enough to code a divergence detector. TradingView also has plenty of public "MACD Divergence" scripts you can reference.

6. Can You Change MACD Parameters?

The defaults (12, 26, 9) come from Wilder's daily-bar work back in the day. For different markets and timeframes, you can tweak them:

ScenarioSuggested paramsRationale
Standard (traditional)(12, 26, 9)General-purpose
More sensitive (short-term)(5, 13, 5)Catches short-term turns; more noise
More stable (medium/long-term)(19, 39, 9)Filters noise but signals are slow
High-vol crypto perps(12, 26, 9) or (8, 17, 9)Standard still works; the shorter set handles fast moves better
Don't over-tune
Tuning too aggressively overfits — perfect on historical data but unreliable going forward. Validate your strategy logic with the standard params first, then forward-test for at least 30 days to confirm it's stable, and only then fine-tune parameters.

7. Common Mistakes

Using MACD in a chop market

MACD is a trend-following indicator, and chop produces a string of fake crosses. Use ADX or a volatility indicator to gauge market state first, and only use MACD when you're in a trending regime.

Using MACD with no stop loss

MACD gives you an entry signal, not exit protection. Pair it with an ATR stop or a fixed-percentage stop — non-negotiable.

Mismatched timeframes

A 1-hour MACD golden cross while the daily is in a death cross → you're entering counter-trend, with a low win rate. Establish the higher-timeframe direction first, then use the lower timeframe to time your entry.

Get started

Ready to ship what you just learned?

Wire your strategy to a TradingView webhook and auto-execute on Binance / OKX / Bybit and 4 more.

Start free trial

8. Advanced: MACD + RSI Double-Confirmation Strategy

A common live combo: MACD gives the entry, RSI filters trend direction.

pine
//@version=5
strategy("MACD + RSI Double Confirmation", overlay=true)

[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
rsi = ta.rsi(close, 14)

// Long: MACD golden cross + MACD > 0 + RSI > 50
longSignal = ta.crossover(macdLine, signalLine) and macdLine > 0 and rsi > 50

// Short: MACD death cross + MACD < 0 + RSI < 50
shortSignal = ta.crossunder(macdLine, signalLine) and macdLine < 0 and rsi < 50

if (longSignal)
    strategy.entry("Long", strategy.long)
if (shortSignal)
    strategy.entry("Short", strategy.short)