MACD¶
Indicators · Momentum
Moving Average Convergence Divergence.
MACD (Moving Average Convergence Divergence) is the Swiss-army momentum indicator: one tool that shows trend direction, momentum, and turning points at a glance. It measures the gap between a fast and a slow EMA — when the fast average pulls away from the slow one, momentum is building; when they converge and cross, momentum is shifting. It's probably the most-used oscillator in trading, and for good reason: it's simple, it's visual, and it fires clean signals.
How it works¶
Three numbers drive it. The MACD line is EMA(fast) − EMA(slow) of the Source — by default the 12-period EMA minus the 26-period EMA. The Signal line is a 9-period EMA of that MACD line. The Histogram is MACD − Signal: it grows when momentum accelerates and shrinks toward zero as a cross approaches. The block also exposes two ready-made triggers — Bull ↑ when the MACD line crosses above the signal, and Bear ↓ when it crosses below — drawn as arrows so you don't have to wire your own crossover.
All three lines plot in a sub-pane beneath price, oscillating around a zero line. Above zero, the fast EMA leads — bullish; below zero — bearish. You control each colour with MACD color, Signal color, and Histogram color.
When to use it¶
MACD shines for momentum confirmation and trend-with-pullback entries: take signals in the direction of the bigger trend and skip the counter-trend ones. The signal-line cross is the classic trigger; the zero-line cross is a slower, higher-conviction trend signal. Its real party trick is divergence — price making a new high while the MACD makes a lower high warns that the move is running out of fuel. Like every momentum tool, it lags in fast reversals and chops you up in flat ranges.
Example¶
A trend-pullback long: define bias with a 200-EMA (only take longs above it), then wire bars into MACD and feed the Bull ↑ output straight into a Buy Signal so you enter when momentum turns back up inside the uptrend. Protect it with an ATR-based Fixed Stop-Loss and set a 2× Reward-to-Risk Target, then run it through the Tester.
Tips & gotchas¶
- The histogram leads the cross. It peaks and starts shrinking before the lines actually cross — a useful early heads-up, and the cleanest place to read divergence.
- Defaults are conventions, not laws. 12/26/9 is the standard, but slower pairs cut whipsaws on noisy assets. Don't over-optimise the exact triplet — it's a classic curve-fit trap.
- Zero line = trend, signal cross = timing. Use them together: cross above zero for bias, signal cross for entry.
- Useless in a dead range. When price goes sideways the lines knot around zero and every cross is a fakeout — gate it with ADX / DMI.
- Not bounded. Unlike RSI or Stochastic, MACD has no fixed 0–100 scale; "overbought" is relative to the asset's own recent range.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| Source | bars / series |
Price bars or any indicator series |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| MACD | series |
Line · sub-pane | MACD line (fast EMA − slow EMA) |
| Signal | series |
Line · sub-pane | Signal line (EMA of MACD) |
| Hist | series |
Line · sub-pane | MACD − signal |
| Bull ↑ | signal |
Signal arrows | MACD crosses above signal |
| Bear ↓ | signal |
Signal arrows | MACD crosses below signal |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Fast EMA | number · 2–200 | 12 |
|
| Slow EMA | number · 2–400 | 26 |
|
| Signal EMA | number · 1–100 | 9 |
|
| Source | choice (close, open, high, low, hl2, hlc3, ohlc4) |
close |
|
| MACD color | colour | #4fc3f7 |
|
| Signal color | colour | #ffb74d |
|
| Histogram color | colour | #90a4ae |
Reference auto-generated from the block catalog · category Indicators.