MACD
MACD (12/26/9 default) via pandas-ta. Returns the MACD line, signal line, and histogram. Edge-first on an upstream close series. Wired to more than one Price Factor, it fans out to per-ticker by_symbol results.
What (One-liner)
MACD triplet (line / signal / histogram), Appel 12/26/9 default — a trend/momentum crossover transform built on chained EMAs.
Inputs
fast(number, optional) — fast EMA period, default 12.slow(number, optional) — slow EMA period, default 26.signal(number, optional) — signal line EMA period, default 9.
Outputs
macd—EMA(fast) - EMA(slow).signal— EMA of the MACD line.histogram—MACD - signal.by_symbol— per-ticker map when fed by multiple Price Factors.
How to use
- Upstream
price_factorprovides the close series. - Optionally override
fast/slow/signalperiods. - Inspect the
macd/signal/histogramarrays.
Core formulas
MACD = EMA(close, 12) - EMA(close, 26)
signal = EMA(MACD, 9)
histogram = MACD - signalpandas-ta returns columns [MACD_12_26_9, MACDh_12_26_9, MACDs_12_26_9] — MACD, histogram, signal. The earlier BUG-GOLDEN-002 swapped index 1 and 2; the golden test caught it and the ordering is now fixed.
Assumptions & applicability
Assumptions: Appel defaults 12/26/9 + EMA adjust=False + pandas-ta equivalent within 1e-10.
Applicability: trend / divergence / crossover signals; equities, FX, crypto, commodities at daily / weekly frequency.
Out of scope: intraday tick, n < 35, sideways whipsaw.
Known limitations
- Lagging indicator — late on sharp reversals.
- Default 12/26/9 periods are convention, not tuned per asset.
- pandas-ta version-drift risk (column ordering was swapped pre-fix; BUG-GOLDEN-002).
References
Appel (1979), original MACD; Murphy (1999), standard interpretation.
Golden Test
tests/golden/fixtures/tier1/compute_macd/ — tolerance 1e-10 absolute, pandas-ta direct call + manual EMA chain cross-check, last verified 2026-05-25, status passing.
Changelog
- 1.0.0 (2026-05-25) — Activated as canonical Layer-1 transform; merged governance fields (incl. BUG-GOLDEN-002 column-ordering history) from the superseded Layer-0
compute_macdcard.

