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
| Setting | Default | What it does |
|---|---|---|
| Basket symbols | EURUSD,GBPUSD,USDJPY,AUDUSD,USDCHF,USDCA | Basket, comma-separated |
| Lookback days | 90 | Momentum lookback, in calendar days |
| Rebalance days | 30 | Minimum days between rebalances |
| Absolute hurdle | 0.0 | Absolute momentum hurdle (fraction return, e.g. 0.0 = must be positive) |
| Use risk sizing | true | Size by percent risk instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Atr period | 14 | ATR period used for the stop distance |
| Atr stop multiple | 3.0 | Stop distance = ATR(InpAtrPeriod) * this multiple |
| Magic number | 20260803 | Magic number for orders opened by this EA |
| Slippage pips | 5 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Momentum · Trailing Stop & Break-even · Risk & Lot Size · ATR · MT4 Expert Advisor · MQL4 Source Code