Skip to content

momentum indicator

MACD backtesting — MACD

MACD (Moving Average Convergence Divergence) tracks the relationship between two EMAs to gauge both trend direction and momentum in one indicator. Its signal-line crossovers are among the most widely used entries in technical analysis — popularity alone says nothing about edge, which is why testing the exact rule matters.

Try MACD on BTC/USDT ETH/USDT SOL/USDT

How MACD works

The MACD line is the difference between a fast EMA and a slow EMA of closing price. A signal line, itself an EMA of the MACD line, smooths that difference to produce a slower-moving reference. The histogram plots the gap between the MACD line and the signal line, visualizing momentum shifts before or as they happen. CandleTest computes all three with TradingView-parity math. Traders read a MACD-above-signal cross as bullish momentum, a cross below as bearish, and the histogram sitting above or below zero as a broader read on which side momentum currently favors — all testable as no-code rules.

MACD settings

Fast Lengthdefault 12

The faster EMA in the MACD calculation. Shorter values make the MACD line more reactive to recent price swings.

Slow Lengthdefault 26

The slower EMA in the MACD calculation. Larger values make the MACD line track longer-term trend, widening the gap it measures against the fast EMA.

Signal Lengthdefault 9

The EMA smoothing applied to the MACD line to produce the signal line. Shorter values make signal-line crosses fire sooner but more often; longer values delay and filter them.

Example MACD strategies to backtest

Signal-line crossover

Enter long when the MACD line crosses above the signal line. Exit when it crosses back below the signal line.

Histogram momentum filter

Enter long when the MACD Histogram is above 0 (bullish momentum). Exit when the MACD Histogram is below 0 (bearish momentum) — a broader, less noisy read on trend direction than the signal-line cross.

Momentum fade exit

Exit an open long when the MACD line crosses below the signal line — treating the bearish crossover as a reason to close the position rather than reverse it (the strategy builder is long-only).

Every rule above is buildable in the no-code strategy builder — pick conditions, press run, and get win rate, drawdown and equity curve on real exchange data with fees and leverage modeled.

MACD FAQ

Is MACD a leading or lagging indicator?

It is lagging — it is built entirely from moving averages of past price, so every cross confirms a shift that has already partly happened. Backtesting shows exactly how much of the move is typically missed before a given crossover fires on your market.

What are the standard MACD settings?

A common starting combination is used widely, but "standard" does not mean "best" for every pair or timeframe — it is simply a reasonable default to begin sweeping from in a backtest.

Does the MACD histogram add anything beyond the crossover?

The histogram shows the gap between the MACD line and the signal line shrinking or growing, which can flag a momentum shift a candle or two before the actual crossover — but it is also noisier. Testing histogram-based rules against plain crossover rules quantifies whether the earlier signal is worth the extra noise.

Should I combine MACD with a trend filter?

Many traders do, since signal-line crosses in a strong opposing trend tend to lose money. The strategy builder lets you AND a MACD condition with, for example, price above a long moving average, and backtesting the combined rule shows whether the filter actually improves results.

Related indicators