Strategy research ·
MACD Backtest Strategy: Test Signal Crosses Without Overfitting
Maintained by the Backtest Editorial Team · Editorial policy
Backtest a MACD strategy with explicit entries, exits, costs, risk controls, chart review, and fresh-period validation instead of trusting a crossover alone.

Quick answer
A MACD crossover is a starting hypothesis, not a complete strategy. A meaningful MACD backtest specifies which cross triggers entry, what confirms it, whether the strategy can short, how it exits, and how fees, slippage, stop loss, and take profit are applied. The result should be reviewed trade by trade and tested again on fresh data.
Turn a crossover into rules
MACD measures the relationship between moving averages, so it can react after price has already moved. Define the rule precisely: for example, enter long only when MACD crosses above its signal line while price is above a higher-timeframe trend filter; exit on the opposite cross or a fixed stop/target. Decide whether both directions are allowed before the test. Without those constraints, the same visual indicator can support many conflicting interpretations.
Backtest setup example
Use ETH/USDT, 1H candles, six months, MACD, both directions, 2% position size, 0.10% commission, 5 bps slippage, a 2% stop loss, 4% take profit, and a signal-and-risk exit mode. Review the first ten trades, then compare the full sample's trade count, net result after costs, profit factor, and drawdown. Repeat the unchanged configuration on a later period before deciding whether a trend filter or different exit is justified.
What the result can reveal
MACD strategies often behave differently in trends and ranges. If losing trades cluster during sideways price action, a trend filter may be a hypothesis worth testing. If gains are repeatedly given back before an opposite cross, an exit variation may be worth evaluating. The important word is variation: change one rule at a time, document it, and validate it on a separate period. Changing fast length, slow length, signal length, stop, target, and dates together only makes a historical fit easier to find.
Common mistakes
- Using a crossover without defining the exit.
- Ignoring costs because indicator signals trade frequently.
- Assuming a visual cross on a chart represents a realistic fill.
- Optimizing several MACD settings against the same market window.
- Calling an in-sample result a prediction instead of monitoring it forward with paper signals.
Risk note
Backtest is for education and strategy research. It is not financial advice, investment advice, a brokerage, an exchange, or an order execution platform. Historical simulation does not guarantee future performance. Trading can result in loss of capital.
Research sources
Related guides
MACD Backtest Settings: Signal Crosses, Momentum, and False Starts
Fix the MACD periods before running. A signal-line cross and a zero-line cross are different rules: if MACD moves from −2 to −0.5 while its signal moves from −1 to −0.8, the bullish signal cross is true although MACD remains below zero. Log those as separate hypotheses. Compare both directions with long only; then, separately, compare signal-and-risk exits with risk-only exits. Keep the same dates and costs, and inspect clusters of repeated crosses because turnover can consume a small gross edge.
Illustrative numbers, not a historical result. Fees and slippage are excluded from this arithmetic.
MACD: −2 → −0.5
Signal: −1 → −0.8
−2 < −1; −0.5 > −0.8; −0.5 < 0
Backtest Trading
Backtest Trading · iOS & Android
Run another setup, inspect every simulated trade, and keep your strategy research close at hand.