What it shows: a pairs trade bets that a spread mean-reverts. That only works if the two assets are cointegrated — a stable long-run relationship — not merely correlated. This simulator estimates the hedge ratio by OLS over a formation window (Engle–Granger step 1), runs a simplified Dickey–Fuller test on the residual spread (step 2), then trades a z-score rule out-of-sample with no look-ahead. It's the intuition behind the pairs trading and statistical arbitrage guides.
All series are synthetic — nothing here is a performance figure or investment advice. The Dickey–Fuller test is simplified (no lag augmentation) and uses the Engle–Granger residual-based 5% critical value of −3.34 for the intuition; production work augments with lagged differences and MacKinnon p-values. Related tools: Backtest Overfitting Simulator · Information Coefficient Calculator · Signal Decay Calculator.
Build a pair
Two assets are built from a shared trend (so they co-move and their returns correlate strongly) plus a spread that mixes a mean-reverting part with a random-walk part. Cointegration strength sets the mix. Watch the correlation stay high while only the stationary spread stays tradeable.
0% = two independent random walks · 100% = a truly stationary spread
how fast the mean-reverting part pulls back to the mean
open a trade when the spread is this many σ from its mean
close the trade when the spread returns inside this band
≈ 3.0 years · first half = formation, second half = out-of-sample trading
a break shifts the hedge ratio out-of-sample