Strategy briefing

Understand what this strategy is actually betting on before you touch the parameter panel.

01
Start with the intuition
02
Use category and difficulty as context
03
Compare before optimizing
01
Map the strategy to a regime thesis
02
Read the math as a constraint system
03
Use parameters to test fragility, not creativity
Learning linkup

Read the model brief like a skeptic

Open Learning Hub

The Intuition

MACD (Moving Average Convergence Divergence) was developed by Gerald Appel in the late 1970s and remains one of the most widely used momentum indicators. It measures the difference between two exponential moving averages (the MACD line) and then smooths that difference with another EMA (the signal line). The cross of the MACD line over its signal line is the trade trigger.

The insight behind MACD: EMA differences capture acceleration in price momentum. When the short-term EMA is pulling away from the long-term EMA (MACD rising), momentum is accelerating — the asset is moving faster than its trend. When the MACD line crosses above its signal line, the recent acceleration is stronger than its short-run average — a confirmation that momentum is building, not just a random fluctuation.

MACD sits between a pure momentum indicator and a trend-following indicator. The EMA construction gives more weight to recent prices (unlike SMA crossovers, which weight all days equally), making MACD more responsive to recent moves. The standard parameters (12, 26, 9) were chosen empirically for daily data and have become a de facto standard — though many practitioners use different settings for different time frames.

Key assumptions: (1) EMA crossovers reliably signal changes in trend direction. (2) The signal line smoothing adds value by filtering noise from the raw MACD line. (3) The 12/26/9 parameters match the momentum persistence of the asset being traded. In practice, these parameters produce shorter holding periods than a 10/50 day SMA crossover — MACD is more of a swing trading indicator.

The strategy's weakness is the same as all crossover approaches: whipsawing in choppy markets. MACD generates many false signals in range-bound conditions. It also lags — being derived from EMAs — which means entries are late in strong trends and exits are late when trends reverse. Practitioners often combine MACD with a trend filter (e.g., only trade in the direction of the 200-day SMA) to reduce false signals.

The Math

Read this as a compact model summary: what the signal sees, what it ignores, and where fragility can creep in.

EMA_fast(t)  = EWM(Close, span=fast)
EMA_slow(t)  = EWM(Close, span=slow)
MACD(t)      = EMA_fast(t) - EMA_slow(t)
Signal_L(t)  = EWM(MACD, span=signal_period)

Signal(t) = +1  if MACD(t) > Signal_L(t)
          = -1  if MACD(t) < Signal_L(t)

Parameters

ParameterTypeDefaultDescription
fast int 12 Fast EMA period
slow int 26 Slow EMA period
signal_period int 9 Signal line EMA period

Source Code

Live source — fetched from engine/strategies/macd.py

Loading source…

Further Reading

  • Appel, G. (2005). Technical Analysis: Power Tools for Active Investors. FT Press.
  • Murphy, J. (1999). Technical Analysis of the Financial Markets. NYIF.
  • Chan, E. (2013). Algorithmic Trading, Ch. 2. Wiley.
Run This Strategy →

Related Momentum Strategies

Use nearby strategies to compare the same market hypothesis under different signal constructions.