# Moving Average Convergence Divergence (MACD)

Category: trend

MACD shows the relationship between two moving averages of a price. It reveals both trend direction and momentum strength.

## Formula

```text
MACD Line = EMA(12) - EMA(26)
Signal Line = EMA(9) of MACD Line
Histogram = MACD Line - Signal Line
```

## Common strategies

- Crossover: MACD line crossing above the signal line is bullish; below is bearish.
- Zero line crossover: MACD crossing above zero confirms uptrend; below zero confirms downtrend.
- Divergence: Price and MACD moving in opposite directions signals potential reversal.

## How CommonQuant uses it

CommonQuant pre-calculates MACD(12,26,9) on all timeframes. DSL strategies can reference macd_line(), macd_signal(), and macd_histogram() functions.

## Frequently asked questions

### What is the MACD histogram?

The histogram shows the difference between the MACD line and the signal line. It visualizes momentum strength — growing bars indicate strengthening momentum.

### Is MACD good for crypto?

MACD works well in trending crypto markets but can give false signals in choppy/ranging conditions. Combine with volatility indicators like Bollinger Bands.

Canonical: https://commonquant.ai/learn/indicators/macd
