Moving Average Convergence Divergence (MACD)

Parameters: fast_period = 12 (2–200) slow_period = 26 (2–200) signal_period = 9 (2–200)

Overview

The Moving Average Convergence Divergence (MACD) is a momentum oscillator that follows trends by showing the relationship between two moving averages of prices. Unlike bounded oscillators like RSI, MACD has no fixed upper or lower limits, making it particularly useful for identifying the strength and direction of trends as well as momentum changes.

MACD consists of three components: the MACD line (difference between two EMAs), the signal line (EMA of the MACD line), and the histogram (difference between MACD and signal line). This multi-component structure provides traders with a comprehensive view of market momentum and potential turning points.

Interpretation & Trading Signals

Signal Line Crossovers:

  • Bullish: MACD line crosses above the signal line (buy signal)
  • Bearish: MACD line crosses below the signal line (sell signal)
  • Strength: Crossovers above zero are stronger than those below

Zero Line Crossovers:

  • Bullish: MACD crosses above zero (fast EMA crosses above slow EMA)
  • Bearish: MACD crosses below zero (fast EMA crosses below slow EMA)
  • Trend Confirmation: Sustained moves above/below zero confirm trend direction

Divergences:

  • Bullish Divergence: Price makes lower lows while MACD makes higher lows
  • Bearish Divergence: Price makes higher highs while MACD makes lower highs
  • Histogram: Expanding histogram shows increasing momentum; contracting shows weakening

Example Usage

Code examples will be available once the Rust implementation is complete.

Performance Analysis

Related Indicators