AnsariOnline logoAnsariOnline

Statistical Arbitrage EA: Trading Mean Reversion Between Correlated Pairs

By Sajjad Ali Ansari · Published 22 September 2026 · Updated 24 November 2026, 06:00 GMT

Rewritten for the new site from the original article's topic. The original post could not be re-fetched, so this is original educational content on the same topic — not a verbatim migration. No performance figures are claimed.

Statistical arbitrage does not predict direction. It bets that the gap between two correlated currencies will shrink back to normal — and it loses when the relationship itself changes.

What's happening

Multi-currency statistical arbitrage — trading the spread between correlated pairs such as EURUSD and GBPUSD, or baskets of related currencies — is a classic quantitative approach now available in retail MetaTrader EAs.

Why it matters

The strategy looks safe because it is market-neutral, but its risk is hidden: when a correlation breaks during a crisis or a central-bank surprise, both legs can move against the trader at once. Understanding that failure mode matters more than understanding the entry.

What statistical arbitrage is

Statistical arbitrage (stat arb) trades the relationship between two or more instruments rather than the direction of any one of them. If EURUSD and GBPUSD usually move together and their spread widens unusually far, the strategy buys the weaker one and sells the stronger one, expecting the spread to narrow again.

The core tool is the z-score: how many standard deviations the current spread sits from its historical average. A high z-score suggests the spread is stretched; a return toward zero suggests it is normalising. Entries, exits and position size all follow from that single number.

In forex the approach is usually applied to correlated majors, to cross pairs, or to baskets — for example trading EUR strength against USD weakness across several pairs at once.

How the EA works

The EA continuously measures the spread between its chosen pairs and computes the z-score over a rolling window. When the z-score crosses its entry threshold, it opens offsetting positions in the two legs, sized so the combined exposure is roughly neutral to the overall market direction.

As the spread narrows, the EA scales out or exits at a target z-score. If the spread keeps widening instead, a hard stop closes the pair of trades — the strategy never adds to a losing spread without a limit, because a widening spread can mean the relationship has broken, not that it is about to snap back.

A correlation monitor runs alongside: if the rolling correlation between the legs drops below a threshold, the EA stops opening new trades until the relationship stabilises.

  • Z-score entry: trade only when the spread is stretched beyond its normal range.
  • Market-neutral legs: long the weak leg, short the strong leg.
  • Hard stop on spread widening — a broken correlation is not a buying opportunity.
  • Correlation filter: pause new trades when the relationship weakens.

Key settings to understand

Stat arb EAs are parameter-heavy, because the strategy is statistical. These are the settings that define its behaviour.

SettingTypical valueWhat it does
Pair / basketEURUSD + GBPUSDCorrelated instruments whose spread is traded.
Lookback window50 - 200 periodsHistory used to compute the spread average and standard deviation.
Entry z-score2.0 - 2.5How stretched the spread must be before trading.
Exit z-score0 - 0.5Where the spread is considered back to normal.
Max spread wideningATR-based stopHard exit if the relationship breaks against the trade.
Risk per pair0.5% of equityFixed risk per spread trade, not per leg.

Risks and honest limits

The biggest risk is regime change: correlations that held for years can break in days around a central-bank surprise, a political shock or a liquidity crisis. When that happens, the spread does not revert — it trends — and mean-reversion traders fund the move.

Stat arb also needs good execution on two symbols at once. Slippage on one leg, or a widened spread during news, changes the economics of the trade after the fact.

Finally, the strategy is data-hungry: a z-score computed on too little history is meaningless, and a strategy tuned to one calm period often fails in the next volatile one. Walk-forward testing and a correlation monitor are not optional extras.

Downloads

AnsariOnline does not currently provide a download for this EA. No verified Drive or GitHub link, version, or backtest report is available, so no download is offered on this page. This guide is educational: it explains how the system works, its settings and its risks.

Related Coverage

Frequently Asked Questions

Is statistical arbitrage risk-free?

No. It is market-neutral, not risk-free. The risk is that the correlation between the pairs breaks down, so the spread keeps widening instead of reverting. That is the strategy's main failure mode.

What is a z-score in trading?

A z-score measures how far a value sits from its average, in units of standard deviation. A spread z-score of +2 means the spread is two standard deviations above normal — stretched, and a candidate for mean reversion.

Can I run stat arb on any two pairs?

No. The pairs need a genuine, stable economic relationship and a high historical correlation. Random pairs produce random spreads, and trading them is just noise.

Key Takeaways

  • Stat arb trades the spread between correlated pairs, not direction.
  • Z-score measures how stretched the spread is versus its history.
  • The main risk is correlation breakdown, not market direction.
  • Needs two-leg execution, a correlation filter and walk-forward testing.

What to Watch Next

  • Fundamental Analysis 101 — why correlations break around central banks.
  • Probability Grid EA — another non-directional approach, with different risks.
  • Bollinger + RSI Scalper EA — mean reversion on a single pair.
Statistical ArbitrageMean ReversionQuantitativeExpert AdvisorCorrelation