Trend following

MACD Trend Following

Ride trends using MACD crossovers, filtered to avoid choppy markets.

Trend-following aims to capture sustained moves. MACD crossovers time entries in the trend direction, while a zero-line filter keeps you out of directionless chop where crossovers whipsaw.

How it works

The MACD line crossing its signal line marks a momentum shift. Requiring MACD to be on the correct side of the zero line (and optionally aligning with a higher-timeframe trend) filters out the low-quality crossovers that occur in ranges.

Entry rules

  • ▸Go long when the MACD line crosses above its signal line while MACD is above zero.
  • ▸Reverse the logic for shorts (cross below signal, MACD below zero).
  • ▸Optionally require price above a long moving average for longs.

Exit & risk

  • ▸Exit on the opposite MACD crossover.
  • ▸Trail a stop using ATR or a moving average to ride extended trends.
  • ▸Cap risk with an initial ATR-based stop.

Best for

Trending markets and higher timeframes. It underperforms in tight ranges, where the zero-line filter and a trend confirmation help most.

Build this strategy in Algovex

Every component of this strategy is a node in Algovex — drop them on the canvas, connect the logic, backtest on a real engine, and export to code. No programming required.

Key terms

Frequently asked questions

Does MACD work for trend trading?

Yes, MACD is fundamentally a trend-following momentum indicator. Filtering crossovers by the zero line and a higher-timeframe trend makes it far more reliable than trading every crossover.