Indicator Formula

Technical Details — MACD (MACD)
Section titled “Technical Details — MACD (MACD)”Overview
Section titled “Overview”MACD calculates the difference between two EMAs and smooths it with a signal line.
Mathematical Derivation
Step 1 — Calculate MACD Line
Section titled “Step 1 — Calculate MACD Line”Purpose: Measure the gap between fast and slow EMAs.
$$MACD = EMA(Close, fast) - EMA(Close, slow)$$
Where:
- $$fast$$ = Fast period (default 12)
- $$slow$$ = Slow period (default 26)
What This Measures: Momentum as the convergence/divergence of two EMAs
Step 2 — Calculate Signal Line
Section titled “Step 2 — Calculate Signal Line”Purpose: Smooth the MACD for crossover signals.
$$Signal = EMA(MACD, signalPeriod)$$
Where:
- $$signalPeriod$$ = Signal line period (default 9)
What This Measures: Smoothed momentum for timing crossovers
Compact Formula Summary
$$MACD = EMA(Close, 12) - EMA(Close, 26)$$ $$Signal = EMA(MACD, 9)$$
Defaults: Fast = 12, Slow = 26, Signal = 9
Complete Calculation Example
If EMA(12) = 45.80 and EMA(26) = 45.20: MACD = 45.80 - 45.20 = +0.60 If Signal = 0.45: MACD > Signal = bullish crossover
Key Takeaways from the Example
- MACD > 0: Fast EMA above slow EMA = bullish trend
- Signal Line Crossover: Timing signal for momentum shifts
- Histogram: Visual representation of crossover momentum