Loading…

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

SettingDefaultWhat it does
Symbol listEURUSD,GBPUSD,USDJPY,AUDUSD,USDCAD,USDCHTraded symbols (basket built from these + Market Watch)
Basket lookback bars24Bars used to measure each currency's percentage move
TimeframePERIOD_H1Timeframe the basket and the deviation are measured on
Zscore bars100Bars of deviation history used for the entry/exit z-score
Entry z2.0|z| at/above this opens a reversion trade
Exit z0.5|z| at/below this closes the open trade
Atr period14ATR period used to size the stop
Stop atr multiple2.5Stop distance, in ATR multiples
Take atr multiple4.0Take-profit distance, in ATR multiples (0 = none, exit on z only)
Risk percent1.0Risk per trade, percent of equity
Magic number20260904Magic number for orders opened by this EA
Slippage pips3Slippage 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: Currency Strength · Risk & Lot Size · ATR · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria