Basket Relative Reversion
Most single-symbol mean-reversion systems judge "too far" from the symbol's own price history alone, which cannot tell a genuine local overextension apart from the symbol simply following a currency that is strong or weak across the board that day. This EA rebuilds a per-currency strength table every bar from every Market Watch symbol whose base/quote metadata the broker declares - the same signed percentage-move aggregation used by the catalogue's CurrencyStrengthSnapshot script - then, for each symbol in InpSymbolList, compares its own percentage move over InpBasketLookbackBars against what its base currency's strength minus its quote currency's strength implied. The gap between the two, not the symbol's raw price, is z-scored over InpZscoreBars and only faded when |z| clears InpEntryZ - relative to that symbol's own recent deviation behaviour, not a fixed number that would mean something different on a quiet pair versus a volatile one. This keeps the system honest about what it is actually detecting: a symbol that ran ahead of its own currencies' basket-wide behaviour, not merely a symbol whose price moved a lot. Notes and limitations - The currency basket table only includes symbols whose broker metadata declares a valid, distinct base and quote currency and that have enough history on InpTimeframe; everything else is silently excluded from the table (not from trading). - Deviation from basket-implied behaviour is a mechanical measurement, not proof of a genuine mean-reverting relationship - a symbol can stay basket-relatively overextended for a long time if its own idiosyncratic driver persists. - Each traded symbol is risked independently; there is no shared portfolio-wide risk cap across symbols the way a multi-pair EA might use - running many symbols at once can compound total exposure. - Every open trade only exits by z-score reversion or its own stop / take-profit; there is no time-boxed exit.
Expert advisor · MT4 · v1.0 · Free
About Basket Relative Reversion
Basket Relative Reversion is an expert advisor (trading robot) for MetaTrader 4 based on ATR. It can size trades from your balance and risk percent. It has 14 settings, such as Symbol list, Basket lookback bars and Timeframe. MQL source code included.
Files in the download: BasketRelativeReversion.ex4, BasketRelativeReversion.mq4, BasketRelativeReversion.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 |
|---|---|---|
| Symbol list | EURUSD,GBPUSD,USDJPY,AUDUSD,USDCAD,USDCH | Traded symbols (basket built from these + Market Watch) |
| Basket lookback bars | 24 | Bars used to measure each currency's percentage move |
| Timeframe | PERIOD_H1 | Timeframe the basket and the deviation are measured on |
| Zscore bars | 100 | Bars of deviation history used for the entry/exit z-score |
| Entry z | 2.0 | |z| at/above this opens a reversion trade |
| Exit z | 0.5 | |z| at/below this closes the open trade |
| Atr period | 14 | ATR period used to size the stop |
| Stop atr multiple | 2.5 | Stop distance, in ATR multiples |
| Take atr multiple | 4.0 | Take-profit distance, in ATR multiples (0 = none, exit on z only) |
| Risk percent | 1.0 | Risk per trade, percent of equity |
| Magic number | 20260904 | Magic number for orders opened by this EA |
| Slippage pips | 3 | 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: Currency Strength · Risk & Lot Size · ATR · MT4 Expert Advisor · MQL4 Source Code