Loading…

Dual Momentum System

This is an adaptation of Gary Antonacci's published Dual Momentum method to a small forex basket. The method is not original to this file - Antonacci built and published it for equity and bond indices with a genuine cash/risk-free instrument to fall back on. Two rules combine: absolute momentum asks whether an instrument's own trailing return is positive; relative momentum ranks a basket and holds only the strongest. Forex has no equivalent of Antonacci's risk-free asset - there is no "cash" position among currency pairs to rotate into when nothing looks strong. This EA substitutes a fixed zero-return hurdle (configurable via InpAbsoluteHurdle): the basket leader must show a positive trailing return over the lookback window before it is held at all: if even the strongest pair in the basket has a negative trailing return, the EA goes flat rather than force a trade. This is stated plainly as an approximation of a risk-free hurdle, not a real rate - genuinely different from Antonacci's original mechanism, not a like-for-like substitute. The other place this implementation deliberately differs from a textbook backtest: Antonacci's published results are academic and do not model spread or swap. This EA does - every rebalance sends real market orders against live spread, and any held position pays real overnight swap. The default monthly rebalance interval (InpRebalanceDays = 30) exists specifically because dual momentum's edge, measured on frequent turnover, would be eroded by FX transaction costs; a much shorter interval is possible via the input but works directly against the strategy's own cost logic. Momentum is measured over a calendar-day lookback (InpLookbackDays) resolved to a bar count with iBarShift on the daily chart, so weekends and holidays do not distort the window the way a fixed bar count would. The basket leader is entered with an ATR-based stop, sized by percent risk or a fixed lot. Notes and limitations RISK WARNING: this is a real trading system, not a demo. It can lose money, including in choppy conditions where the basket leader rotates without a sustained trend forming. Test on a demo account first. Only one basket position is ever held at a time (the single leader). This is a design choice for simplicity and cost control, not a limitation of the method - Antonacci's original also frequently holds a single top-ranked asset. The absolute-momentum hurdle is a fixed number, not a market-derived risk-free rate - it does not adapt to interest-rate cycles the way a genuine cash-instrument comparison would. Treat it as a simple sanity filter, not a precise replication of the original method's economic logic. Momentum is measured on daily closes regardless of the chart timeframe the EA is attached to; the chart itself is only used as a place to run OnTick and does not affect the calculation.

Expert advisor · MT4 · v1.0 · Free

About Dual Momentum System

Dual Momentum System is an expert advisor (trading robot) for MetaTrader 4 based on ATR. It moves the stop loss behind price (trailing stop / break-even) and can size trades from your balance and risk percent. It has 13 settings, such as Basket symbols, Lookback days and Rebalance days. MQL source code included.

Files in the download: DualMomentumSystem.ex4, DualMomentumSystem.mq4, DualMomentumSystem.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Basket symbolsEURUSD,GBPUSD,USDJPY,AUDUSD,USDCHF,USDCABasket, comma-separated
Lookback days90Momentum lookback, in calendar days
Rebalance days30Minimum days between rebalances
Absolute hurdle0.0Absolute momentum hurdle (fraction return, e.g. 0.0 = must be positive)
Use risk sizingtrueSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked per trade, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Atr period14ATR period used for the stop distance
Atr stop multiple3.0Stop distance = ATR(InpAtrPeriod) * this multiple
Magic number20260803Magic number for orders opened by this EA
Slippage pips5Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Momentum · Trailing Stop & Break-even · Risk & Lot Size · ATR · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria