Backtest Studio — every lever, in one place.
Sliders for entry/exit, costs, slippage, exposure caps, drawdown limits, time-stops. Runs entirely in your browser. Costs are baked into daily returns so Sharpe and the equity curve agree.
Parameters
Pair
Hedge model
Sizing
Hedge window60 bars
Z-score window60 bars
Z entry2.00
enter long-spread when z ≤ −entry, short-spread when z ≥ +entryZ exit0.50
close when |z| crosses back through this levelZ stop-loss4.00
Time stop30 bars
One-way cost2.0 bps
commissions per leg per fillSlippage1.0 bps
Drawdown stop0.25
strategy halts if equity drawdown exceeds this fractionCapital at risk1.00
Performance
17 tradesTotal return-19.8%
CAGR-4.32%
Sharpe-0.30
Sortino-0.17
Max DD23.3%
Calmar-0.19
Hit rate52.9%
Avg holding21.8bars
Vol (annualised) 12.3%Costs paid 2.04%CVaR 95% -2.07%Total trades 17
bootstrap (300 resamples · stationary · block ≈ 21)
Median Sharpe -0.3090% CI [-0.71, 0.13]95% CI [-0.75, 0.18]Median total -20%
Equity curve vs benchmarks
starting capital = 1.0Pairs trading is a market-neutral strategy; the right benchmarks are 0% and the equal-weight long-only basket — not the S&P. Most pair Sharpes look small until you compare to the blue line, which carries full market β.
Drawdown
stop @ 25%Z-score with positions
solid orange — z-scorecyan step — position (−1 short / 0 flat / +1 long)orange dashed — entry bands ±2green dashed — exit bands ±0.5red — stop-loss bands ±4
Trade P&L distribution
Trade ledger
17 trades| Side | Entry | Exit | Bars | Z entry | Z exit | P&L | Reason |
|---|---|---|---|---|---|---|---|
| short | 2024-08-22 | 2024-10-03 | 30 | 2.05 | 0.36 | +0.41% | z-exit |
| long | 2024-07-05 | 2024-08-12 | 26 | -2.03 | -0.47 | -4.40% | z-exit |
| short | 2024-01-24 | 2024-02-15 | 16 | 2.49 | 0.37 | -4.47% | z-exit |
| long | 2024-01-01 | 2024-01-17 | 12 | -2.14 | 0.22 | -5.03% | z-exit |
| long | 2023-10-03 | 2023-11-14 | 30 | -2.01 | -1.27 | +1.60% | time-stop |
| short | 2023-06-12 | 2023-07-21 | 29 | 2.01 | 0.48 | -5.50% | z-exit |
| long | 2023-02-14 | 2023-03-28 | 30 | -2.27 | -0.64 | +1.44% | time-stop |
| short | 2022-12-23 | 2023-01-13 | 15 | 2.03 | 0.24 | -5.42% | z-exit |
| short | 2022-11-23 | 2022-12-14 | 15 | 2.11 | 0.41 | +2.35% | z-exit |
| short | 2022-07-12 | 2022-07-25 | 9 | 2.12 | 0.45 | +1.76% | z-exit |
| long | 2022-04-29 | 2022-06-10 | 30 | -2.07 | -0.81 | +1.19% | time-stop |
| short | 2021-12-15 | 2022-01-12 | 20 | 2.52 | 0.05 | +2.97% | z-exit |
| long | 2021-09-23 | 2021-11-04 | 30 | -2.05 | -0.97 | +1.16% | time-stop |
| short | 2021-07-05 | 2021-07-16 | 9 | 2.03 | 4.04 | -3.51% | stop-loss |
| long | 2021-02-22 | 2021-04-05 | 30 | -2.20 | -1.02 | -2.07% | time-stop |
| short | 2020-12-16 | 2021-01-12 | 19 | 2.55 | 0.42 | +4.27% | z-exit |
| short | 2020-07-02 | 2020-07-31 | 21 | 2.18 | 0.45 | -5.01% | z-exit |
Trade P&L heatmap — entry-z × holding period
cell = avg fractional P&L · count| entry-z \ bars | ≤5 | 6–10 | 11–20 | 21–40 | 41+ |
|---|---|---|---|---|---|
| ≤−3 | · | · | · | · | · |
| −3..−2.5 | · | · | · | · | · |
| −2.5..−2 | · | · | -5.03% n=1 | -0.18% n=6 | · |
| −2..0 | · | · | · | · | · |
| 0..2 | · | -0.88% n=2 | -2.52% n=3 | -3.37% n=3 | · |
| 2..2.5 | · | · | 3.62% n=2 | · | · |
| 2.5..3 | · | · | · | · | · |
| ≥3 | · | · | · | · | · |
Tells you which entry-z and holding-period buckets are profitable on this pair. Negative diagonal cells (deep z, long holding) typically expose stop-loss leakage; shallow-z + short-holding cells should look the strongest if mean reversion is working.