MACD strategy: settings, signals and a backtest checklist
The MACD strategy is the most-used momentum system in retail trading — and the most over-tuned. This cheat sheet strips it to the three signals that matter, the settings worth testing, the filters that stop it whipsawing you, and the backtest steps that separate a real edge from a curve-fit fantasy.
The three signals every MACD strategy uses
MACD (Moving Average Convergence Divergence) is built from two exponential moving averages and a signal line. For the full mechanics, see our deeper MACD trading strategy guide; here we focus on turning it into rules you can test. Three signals do the work:
- Signal-line crossover — buy when the MACD line crosses above the signal line, exit or short when it crosses below. This is the workhorse but it fires constantly in chop.
- Zero-line crossover — MACD above zero means the fast EMA leads the slow one (bullish bias). Filtering crossover trades to only the side of the zero line removes a large share of false signals.
- Divergence — price makes a new high while MACD makes a lower high. A respected early reversal warning, but unreliable alone; use it to confirm, not trigger.
Settings that actually matter
The default 12/26/9 is a convention, not a law of markets. Faster settings (e.g. 8/17/9) react sooner but whipsaw more; slower settings (e.g. 19/39/9) cut noise but lag. The honest truth is that no single setting wins everywhere — and chasing the "best" setting is exactly how people overfit. Test two or three settings across multiple symbols and timeframes, and prefer the one that is least sensitive to small parameter changes, not the one with the single highest return.
Filters that cut the whipsaw
A raw crossover bot loses money in ranges. Two filters help most: (1) only take crossovers in the direction of a longer trend — for example, longs only when price is above its 200-period EMA — and (2) require the histogram to exceed a small threshold so micro-crossovers are ignored. Both are forms of regime filtering, the same idea that rescues the EMA crossover strategy from sideways markets.
The backtest checklist
Before trusting any MACD rule, run it through the strategy backtester and confirm: realistic fees and slippage are included; the result holds out-of-sample (not just on the data you tuned on); the equity curve is not driven by two lucky trades; and the drawdown is survivable. A MACD bot that looks brilliant only on 12/26/9 and falls apart at 11/25/9 has no edge — it has a coincidence. Learn the trap in overfitting in trading.
Frequently asked questions
What are the best MACD settings?
There is no universally best setting; 12/26/9 is the convention. Faster settings react sooner but whipsaw more, slower ones lag. The most robust choice is one that performs similarly across nearby parameters and multiple symbols, not the single highest-returning one in a backtest.
Does the MACD strategy work?
MACD can add value as a trend-momentum filter, but a raw crossover bot loses money in range-bound markets because of whipsaw. Adding a trend filter and a histogram threshold, then validating out-of-sample, is what makes it usable.
Is MACD better than RSI?
They measure different things — MACD tracks trend momentum, RSI tracks overbought/oversold conditions. Many traders combine them. Neither is reliable alone without filters and proper backtesting.
Can I automate a MACD bot?
Yes. The crossover logic is simple to code, and platforms like TradingView (via Pine Script and webhooks) or ccxt-based Python bots execute it. The hard part is risk management and avoiding overfit settings, not the signal itself.