← ai·maturity Lab Demo · synthetic data · runs in your browser
Worum geht es

Eine einfache Handelsstrategie wird auf synthetischen Kursen optimiert: In-Sample glänzend, Out-of-Sample ernüchternd. Wählen Sie Strategie, Kosten und Optimierungsziel, erzeugen Sie neue Märkte und vergleichen Sie mit Walk-Forward und Monte Carlo. Achten Sie auf das Overfitting-Meter.

What this is about

A simple trading strategy is optimised on synthetic prices: brilliant in sample, sobering out of sample. Choose strategy, costs and optimisation target, generate new markets and compare with walk-forward and Monte Carlo. Note the overfitting meter.

Why the Backtest Lies optimising

Finance & markets · maturity phase 2 · optimise a strategy in-sample, then test the same parameters on data it has never seen

In-sample Sharpe
–
best of grid
Out-of-sample Sharpe
–
same parameters
Sharpe decay
–
OOS ÷ IS
Max drawdown (OOS)
–
peak to trough
Trades
–
in-sample · out-of-sample
Costs paid
–
on 100 000 start capital

Price & equity · in-sample vs out-of-sample –

Synthetic price (log) Strategy equity, in-sample (optimised here) Strategy equity, out-of-sample (never seen) Drawdown stop fired Regime ribbon (hidden truth): trend up trend down mean-reverting choppy

Metrics · same parameters, two windows –

MetricIn-sampleOut-of-sampleBuy & hold (OOS)

Walk-forward · rolling re-optimisation –

Walk-forward: stitched out-of-sample equity (each fold uses parameters chosen on the preceding 600 bars) Single split: out-of-sample equity of the one chosen parameter set
FoldBarsChosen parametersIS SharpeOOS SharpeOOS trades

Monte-Carlo robustness · 200 resamples of the out-of-sample trades –

Final equity (× start)

Maximum drawdown

Resampled paths 5 % / 95 % band Actual out-of-sample result

Parameters, costs & risk caps –

Strategy parameters (snap to grid)
–
–
Position sizing
15 %
1.50×
Cost model (toggle in the header)
$
bps
bps
Risk caps
%
%
Validation

Overfitting meter

< 0 · edge gone0.50.81.0 · held
–

Sharpe decay (OOS ÷ IS)
–
Plateau score (neighbours ÷ peak, IS)
–
Grid median OOS Sharpe
–
Grid cells beating the chosen one OOS
–
Walk-forward OOS Sharpe
–

Parameter heatmap · in-sample Sharpe click a cell to inspect

negative ≈ 0 positive chosen too few trades / invalid

How it works

The market is synthetic: a seeded geometric Brownian motion with hidden regime switching (trend up, trend down, mean-reverting, choppy) and GARCH-style volatility clustering, 2,000 daily bars, deterministic per seed. By default it contains no exploitable edge — any pattern a strategy finds is noise. Bars 200–1199 are the in-sample window (indicator warm-up before that), bars 1200–1999 the out-of-sample window. The optimiser runs a grid search over the two main parameters of the chosen strategy on the in-sample window and keeps the cell with the best objective (Sharpe, or CAGR divided by max drawdown) that also meets the minimum trade count. The very same parameters are then run on the out-of-sample bars. Position size is set at entry from a volatility target (size = target / realised 20-day vol, capped), costs are charged on turnover (half-spread + slippage in bps) plus a fixed commission per trade, and the risk caps act exactly as a broker risk desk would: a daily loss beyond the limit forces one flat day, a drawdown beyond the limit switches the strategy off for the rest of the window.

Reading the result. The heatmap shows the in-sample landscape: a sharp isolated peak means the optimiser found a coincidence, a broad plateau means neighbouring parameters agree. The Sharpe decay (out-of-sample ÷ in-sample) is the overfitting meter; with a pure-noise market it scatters around zero regardless of how good the in-sample number looked. Walk-forward re-optimises on a rolling 600-bar window and stitches only the unseen segments — the honest performance estimate. Monte-Carlo resamples the out-of-sample trades 200 times to show how wide the band of plausible outcomes is for the same strategy. Toggle Inject a true edge to add a mild, persistent momentum drift after 10-day moves and see what a real edge looks like: in-sample and out-of-sample agree, the plateau is broad, walk-forward stays positive — and the mean-reversion strategy, which bets against that drift, now loses out-of-sample instead of merely decaying.

Everything here is simulated and computed locally in your browser; no market data, no account, no server. This is not investment advice and nothing shown is a tradeable system. The lesson is one of validation discipline — phase 2 of the maturity model, where a project moves from a promising number to a measurable, reproducible claim. The next honest step after a clean out-of-sample and walk-forward picture is a paper run against real brokerage data, with the same cost model and risk caps, before a single unit of capital is committed.