LearnForexHub
EA

EA: Momentum Cross Expert Advisor

Written by , Founder & EditorLast updated How we write and review lessons

An Expert Advisor doesn't merely signal like an indicator does — it opens and manages positions for you. This free EA trades a single, transparent momentum strategy built around the Momentum indicator's 100 centerline: it enters the moment Momentum crosses back through 100, then manages Stop Loss, Take Profit, and position size automatically from the same risk tools taught elsewhere on this site.

How the Strategy Works

The entry signal is the Momentum indicator's centerline cross — the same 100 level explained in the site's Momentum lesson. Momentum is calculated as the current closing price divided by the closing price MomentumPeriod bars ago, multiplied by 100: a reading above 100 means price is higher now than it was that many bars back (upward momentum), a reading below 100 means price is lower now (downward momentum), and exactly 100 means price is unchanged over the lookback. This EA uses the default MomentumPeriod of 14 bars applied to the close.

What makes Momentum different from RSI or CCI is that it has no universally agreed overbought or oversold zone. RSI has a widely used 70/30 convention, and CCI has ±100, but Momentum's raw output is an unbounded ratio around 100 whose typical range depends entirely on the pair's volatility and the lookback period chosen — there's no fixed number above which "too far" reliably means anything. Because of that, the 100 centerline itself is the entire signal this EA trades: not a level to fade or wait out, but the one place on the whole indicator where the calculation actually changes sign, from price being lower than it was MomentumPeriod bars ago to higher, or the reverse. That's a meaningfully different design decision than trading a zone boundary, and it's why this EA's logic is so short — there's exactly one condition to check, not a zone entry plus a zone exit.

Stop Loss, Take Profit, and Position Sizing

PriceTake Profit (TP)Stop Loss (SL)BUY100Momentum (oscillates around a 100 centerline)
Entry conditions: BUY when Momentum crosses back above 100 — SELL on the mirrored cross back below 100 — SL and TP are placed automatically from ATR

Stops and targets here come from ATR, not fixed pips — when the pair moves more, the stop widens; when it quiets down, the stop tightens, tracking current conditions instead of a number set once and forgotten. Stop Loss distance is ATRMultiplier × ATR (default multiplier 2.0, with ATR calculated over ATRPeriod = 14 bars), and Take Profit is then set at RiskRewardRatio × Stop Loss distance (default 2.0), so every trade this EA opens carries a fixed, known reward-to-risk proportion regardless of which pair or timeframe it's trading.

Lot size comes from the same arithmetic taught in Risk Management Basics: the account fraction you risk (RiskPercent, default 1.0%) divided by the stop distance. A wider ATR-based stop on a volatile pair automatically produces a smaller lot, and a tighter stop on a calm pair produces a larger lot, so the dollar risk per trade stays roughly constant even though the price distance to the stop changes trade to trade. A UseFixedLot input is available as an escape hatch for traders who'd rather trade a constant lot size regardless of risk percentage — useful for testing or for small accounts where percentage-based sizing rounds to the broker's minimum lot anyway.

Entry Conditions

  • BUY — Momentum crosses from at-or-below 100 to above 100 on consecutive completed bars: the previous bar's Momentum reading was 100 or lower, and the current bar's reading is above 100.
  • SELL — Momentum crosses from at-or-above 100 to below 100 — the mirrored setup.

Beyond the signal itself, three safety mechanics govern every trade: the EA only evaluates these conditions once per new bar (not on every tick, so a single crossover can't fire multiple trades within the same candle), only opens one position at a time (a new signal is ignored while a position from this EA is already open), and only manages positions tagged with its own magic number (20260731) — so it never touches trades you open manually or trades placed by a different EA running on the same account. A spread filter also sits in front of every entry: if the current spread is wider than MaxSpreadPoints, the EA skips that bar entirely rather than opening a trade at a bad price during illiquid conditions.

Parameters

  • MomentumPeriod (default 14) — the number of bars back the current close is compared against; this is the entire lookback the indicator uses.
  • AppliedPrice (default Close) — the price series Momentum is calculated from.

The other inputs are the site's standard risk engine (ATRPeriod, ATRMultiplier, RiskRewardRatio, RiskPercent, UseFixedLot, FixedLotSize, MaxSpreadPoints, EnableTrading, MagicNumber), and each default is explained once in the risk-engine section of the EA hub. This EA's own magic number is 20260731.

Why a Raw Centerline Cross, and How It Compares to Other Momentum EAs

This EA trades every 100-centerline cross exactly as it happens, with no zone confirmation, no minimum distance from 100 required, and no trend filter layered on top. That's worth comparing to the site's other centerline/zero-line-cross EAs, the Awesome Oscillator momentum EA and the MACD momentum EA, because all three trade a crossing-through-a-fixed-level signal but derive it from different math. MACD's cross comes from two exponential moving averages of price crossing a further-smoothed signal line, which builds in some lag and noise filtering. The Awesome Oscillator's zero cross comes from two simple moving averages of the bar's midpoint, with no signal line at all. Momentum's cross is simpler again: it's a direct ratio between today's close and the close MomentumPeriod bars back, with no averaging step anywhere in the calculation. That makes it the most literal of the three, reacting to a genuine price change immediately, but also the most exposed to a single noisy bar flipping the ratio back across 100 before any real move has developed.

That trade-off is sharpest in a quiet, range-bound market. When price drifts sideways, the close MomentumPeriod bars ago and the current close stay nearly equal, so the ratio hovers tightly around 100 and crosses it repeatedly — each cross is a technically valid signal by this EA's rule, but collectively that's a whipsaw pattern that bleeds small losses to spread and slippage on every false entry. This EA therefore tends to perform best in markets that are trending or just breaking out of a range, where a centerline cross reliably marks the start of a real move, and worst in tight, directionless conditions. Checking trend vs range conditions before running this EA on a given pair is the single highest-leverage thing a trader can do to improve its results, even though the EA makes no attempt to detect that condition automatically — it trades the cross wherever and whenever it happens, and adding a moving-average or ADX-based trend filter on top is a natural next customization for anyone comfortable editing the source.

A Word of Caution

Demo-test it first under as many market conditions as you can — performance to date, backtested or live, never guarantees future performance. Losing trades are part of any strategy, human or automated, and this EA is no exception. Momentum's centerline-cross signal has no built-in filter for choppy conditions: when the oscillator hovers tightly around 100 in a quiet or ranging market, expect a run of false crosses in quick succession, each one a small loss from spread alone. Consider pairing this EA with a trend filter, or only running it on pairs and timeframes you've confirmed are trending, rather than leaving it on every chart in every condition. Open the source in MetaEditor and walk through it; if a parameter's purpose isn't clear to you yet, that's the signal to keep reading before you use it. Take this page as classroom material: an explanation of a method, not advice directed at you.

Download momentum-cross-ea.mq4

For MetaTrader 4 — this is source code (.mq4), open and review it fully before using it.

Download File

Download momentum-cross-ea.mq5

For MetaTrader 5 — this is source code (.mq5), open and review it fully before using it.

Download File

How to install

An EA installs into the Experts folder, not Indicators — this is the step people miss most often.

MetaTrader 4

  1. Download momentum-cross-ea.mq4 above.
  2. Open MetaTrader 4FileOpen Data Folder.
  3. Place the file in the MQL4/Experts folder.
  4. Restart MetaTrader 4, then drag it from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA places no trades while this is off, even when attached to a chart.
  6. Review and adjust the input parameters in the settings dialog before confirming.

MetaTrader 5

  1. Download momentum-cross-ea.mq5 above.
  2. Open MetaTrader 5FileOpen Data Folder.
  3. Place the file in the MQL5/Experts folder.
  4. Restart MetaTrader 5, then drag it from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA places no trades while this is off, even when attached to a chart.
  6. Review and adjust the input parameters in the settings dialog before confirming.

Both files are source code. Open and read them in MetaEditor before running them on any account.