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.
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.
Finance & markets · maturity phase 2 · optimise a strategy in-sample, then test the same parameters on data it has never seen
| Metric | In-sample | Out-of-sample | Buy & hold (OOS) |
|---|
| Fold | Bars | Chosen parameters | IS Sharpe | OOS Sharpe | OOS trades |
|---|
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.