QuantSpread Terminal
- Experts
- Version: 1.0
- Activations: 5
QuantSpread Terminal — Statistical Pair (Spread) Trading EA
Trade the relationship between two instruments, not their direction.QuantSpread Terminal is a market-neutral Expert Advisor built around a rolling linear-regression model. Instead of predicting whether a single symbol will rise or fall, it continuously measures the statistical relationship between two correlated instruments (default: EUR/USD and XAU/USD) and trades the moments when that relationship stretches too far from its historical norm — buying the relatively cheap leg and selling the relatively expensive one, then closing both legs together once the spread reverts.
Because every position is simultaneously hedged by an opposite trade on the second symbol, the strategy is designed to be far less sensitive to outright market direction than a typical directional EA, while still producing frequent, short-duration trading opportunities.
How it works
- **Regression model** — on every closed bar, the EA runs an Ordinary Least Squares regression of Symbol B against Symbol A over a configurable lookback window, producing a "fair value" spread.
- **Z-score with EMA smoothing** — the current spread's deviation from its historical mean is converted into a smoothed z-score.
- **Correlation filter** — trades are only allowed when the rolling correlation between the two symbols (price levels or returns) is above a configurable threshold, avoiding periods where the pair relationship has broken down.
- **Entry** — when the smoothed z-score exceeds the entry threshold, the EA opens both legs at once in opposite directions.
- **Exit** — the basket is closed on whichever comes first: mean reversion of the z-score, a floating-profit money target, a protective loss limit, or a maximum holding-time safety exit.
- **Cooldown** — a configurable pause after each closed basket prevents immediate re-entry into the same noise.
Key features
- Fully self-contained rolling regression / z-score / correlation engine — no external indicators or DLLs required
- Simultaneous, hedge-aware order execution: if one leg fails to fill, the other is automatically unwound to avoid a naked directional position
- Configurable position sizing: fixed lots per leg, or % risk-based
- **Daily profit target and daily loss limit** (% of day-start balance) with automatic trading pause for the rest of the day
- Hard account-drawdown kill-switch
- Separate time windows for opening and closing baskets (e.g. avoid opening new trades near session close while still allowing an open position to be managed)
- Spread filters on both legs, order retry logic on requotes/timeouts, and full trade-journal logging
- Live on-chart dashboard: account balance/equity/margin, current spread and z-score, correlation, daily/monthly/total P&L, strategy signal state and cooldown timer
- Built-in `OnTester()` optimization criterion (net profit / max drawdown) for meaningful optimization results
Recommended setup
- **Symbols:** any two liquid, historically correlated instruments (default configuration: EURUSD / XAUUSD)
- **Timeframe:** M1 (the EA runs its own regression window internally; chart timeframe only needs to match `InpTimeframe`)
- **Account type:** ECN/Raw-spread account recommended — the strategy trades frequently, so low spread and commission matter
- **VPS:** recommended for 24/5 uptime, since baskets are managed on every tick
Important notes
- This is a statistical strategy: its edge depends on the historical correlation and regression relationship between the two chosen symbols continuing to hold. Always re-validate `InpEntryZScore`, `InpExitZScore`, `InpLookback`, `InpSmoothing` and `InpCorrThreshold` on your own broker's historical data before trading live.
- Past backtest performance does not guarantee future results. Statistical arbitrage strategies can experience periods of correlation breakdown; use the built-in daily loss limit and account drawdown kill-switch.
- Requires both symbols to be available and selected in Market Watch on the trading account/broker.
