4.6.10Trading Strategies

Learn MACD-based systems

1,707 words8 min readdifficulty · medium

WHAT is MACD?

WHY these numbers (12, 26, 9)? They are the classic defaults Gerald Appel chose in the 1970s (roughly 2 weeks, 1 month, and ~2 weeks of trading days). They are conventions, not laws — you can tune them, but everyone watching the same defaults creates self-fulfilling behavior.


HOW: derive it from first principles

Step 1 — Why EMA instead of a simple average?

A Simple Moving Average (SMA) treats a price 26 days ago the same as yesterday. But recent prices matter more for momentum. The EMA fixes this by weighting recent prices heavier.

Why α=2/(n+1)\alpha = 2/(n+1)? The average age of data in an SMA of length nn is (n1)/2(n-1)/2. The average age of the geometric EMA weights is (1α)/α(1-\alpha)/\alpha. Setting them equal: 1αα=n12    α=2n+1.\frac{1-\alpha}{\alpha} = \frac{n-1}{2} \;\Rightarrow\; \alpha = \frac{2}{n+1}.

Step 2 — Build the MACD line

MACDt=EMA12(P)tEMA26(P)t\text{MACD}_t = \text{EMA}_{12}(P)_t - \text{EMA}_{26}(P)_t

WHY the difference? The 12-EMA reacts faster than the 26-EMA. When price rallies, the fast one pulls up first, so their gap grows → positive & rising MACD = accelerating uptrend. When they cross, MACD crosses zero.

Step 3 — Signal line & histogram

The raw MACD is jumpy. Smooth it once more: Signalt=EMA9(MACD)t,Histt=MACDtSignalt.\text{Signal}_t = \text{EMA}_9(\text{MACD})_t, \qquad \text{Hist}_t = \text{MACD}_t - \text{Signal}_t.

WHY a histogram? Hist\text{Hist} is the derivative-like quantity: it flips sign exactly when MACD crosses Signal, and its height shows how fast momentum is separating. Shrinking bars = momentum weakening before the actual crossover — an early warning.

Figure — Learn MACD-based systems

The three trading signals


Worked Examples


Common Mistakes (Steel-manned)


Recall Feynman: explain to a 12-year-old

Imagine two friends walking: a fast friend and a slow friend. When they're running downhill (price rising), the fast friend gets way ahead — the gap between them grows. MACD is just that gap. When the fast friend starts getting tired and the gap stops growing, you know they're about to slow down — that's your early clue the "walk" (trend) is ending. The histogram is just how quickly that gap is changing.


Active Recall

What are the three components of MACD?
MACD line (EMA12 − EMA26), Signal line (EMA9 of MACD), Histogram (MACD − Signal).
What is the EMA smoothing constant formula?
α=2n+1\alpha = \dfrac{2}{n+1}.
Why derive α=2/(n+1)\alpha = 2/(n+1)?
It makes the EMA's average data-age equal that of an n-period SMA, i.e. (1α)/α=(n1)/2(1-\alpha)/\alpha = (n-1)/2.
What does a MACD zero-line crossover mean?
EMA12 crosses EMA26, i.e. the fast trend flips direction — a slower, stronger confirmation than the signal-line cross.
What is bearish divergence in MACD?
Price makes a higher high but MACD makes a lower high → momentum weakening → possible reversal down.
Why does MACD whipsaw in sideways markets?
The two EMAs keep swapping order, producing repeated false crossovers; filter with a trend condition.
Why can't you compare raw MACD across two stocks?
MACD is in the price units of each stock, so a high-priced stock has larger MACD values regardless of momentum.
What does the histogram represent mathematically?
MACD line − Signal line; its sign flips exactly at signal-line crossovers.
Compute a 3-period EMA seed for prices 100,102,101.
SMA = (100+102+101)/3 = 101.

Connections

  • Exponential Moving Average
  • Simple Moving Average
  • Momentum Indicators
  • RSI vs MACD
  • Divergence Trading
  • Trend Filters and 200-day SMA
  • Whipsaw and False Signals

Concept Map

EMA12 fast

EMA26 slow

weights recent prices

derived from

subtract

subtract

EMA9 smoothing

minus signal

minus from MACD

measures

crossover triggers

early warning shrinking bars

Price series

Fast EMA 12

Slow EMA 26

EMA recursion, alpha = 2 / n+1

MACD line

Signal line

Histogram

Momentum change

Trading signals

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, MACD ka core idea bahut simple hai: hum do moving averages lete hain — ek fast (12-period EMA) aur ek slow (26-period EMA). Jab price upar jaati hai to fast wala pehle react karta hai, isliye dono ke beech ka gap badhta hai. Yeh gap hi MACD line hai. Gap badh raha hai matlab momentum strong hai; gap ghat raha hai matlab momentum thanda pad raha hai. Toh MACD asal me price ko nahi, momentum ke change ko track karta hai.

EMA kyun, SMA kyun nahi? Kyunki SMA me 26 din purani price aur kal ki price ko barabar weight milta hai, jo galat hai — recent price zyada important hai. EMA recent prices ko zyada weight deta hai, aur uska smoothing constant α=2/(n+1)\alpha = 2/(n+1) hota hai (yeh formula humne derive kiya taaki EMA ki "average age" SMA jaisi rahe). Signal line MACD ka hi EMA-9 hai (aur smooth), aur histogram = MACD − Signal — yeh bars jab shrink hone lagti hain to crossover se pehle hi warning de deti hain.

Trading me teen signal use hote hain: signal-line crossover (jaldi entry, par sideways market me whipsaw), zero-line crossover (slow par strong confirmation, kyunki tab EMA12 ne EMA26 ko cross kiya), aur divergence (price naya high banaye par MACD nahi — yeh reversal ka hint). Yaad rakhna: sideways market me MACD bahut fake signals deta hai, isliye ek trend filter (jaise 200-day SMA) laga do. Aur do alag stocks ka raw MACD kabhi compare mat karna — kyunki woh price units me hota hai, ₹3000 wale stock ka MACD ₹30 wale se automatically bada dikhega.

Test yourself — Trading Strategies