Skip to content

Superseded (2026-05-25) — this operator is a Layer-1 transform, not a Layer-0 atomic input. Merged into compute_macd_v1. Kept for history.

What (One-liner)

MACD triplet (line / signal / histogram), Appel 12/26/9 default. PR #23 fixed pandas-ta dispatch + column ordering bug.

How to use

python
from services.algo.technical import compute_macd
macd, signal, hist = compute_macd(prices, fast=12, slow=26, signal=9)

Core formulas

MACD = EMA(prices, 12) - EMA(prices, 26)
signal = EMA(MACD, 9)
histogram = MACD - signal

pandas-ta returns columns are [MACD_12_26_9, MACDh_12_26_9, MACDs_12_26_9] — MACD, histogram, signal. Previous BUG-GOLDEN-002 swapped index 1 and 2; golden test caught it.

Assumptions & applicability

Assumptions: Appel defaults 12/26/9 + EMA adjust=False + pandas-ta 1e-10 equivalent.

Applicability: trend / divergence / crossover signal.

Not applicable: intraday tick, n<35, sideways.

Known limitations

  1. Column ordering was swapped (BUG-GOLDEN-002, fixed)
  2. pandas-ta version drift risk
  3. Fixed 12/26/9

References

Appel (1979) original + Murphy (1999) standard interpretation.

Golden Test

tests/golden/fixtures/tier1/compute_macd/, 1e-10, 2026-04-20 passing.

Changelog

  • 1.0.0 (2026-04-20) — BUG-GOLDEN-002 fix + first Active

Verifiable intelligence for the decisions that demand scrutiny.