Optimization and the Overfitting Trap
The optimizer finds your best parameters — on the past. Handle with care.
Written and reviewed by the Fundezy team · how we produce this
Optimization automates the experiment loop: pick input parameters to sweep (e.g. FastMAPeriod 5–25, SlowMAPeriod 20–60), and the Strategy Tester runs the backtest for every combination, ranking results. It is the most powerful feature in the platform — and the most dangerous button on it.
How a sweep works
For each parameter combination, the engine runs the full backtest and records the metrics. A 5×5 grid = 25 complete runs over your chosen history. The output table shows, per combination: net P/L, trades, win rate — the map of your strategy's parameter landscape.
Reading the landscape matters more than finding its single tallest peak:
- Robust plateau — a broad region of neighboring parameters all profitable: the strategy has a real property. Fast 12 / Slow 35 working? So should 11/34 and 13/36.
- Lonely spike — one combination shines while its neighbors lose: you have found noise with coordinates. That parameter set encodes this specific history, not the market.
Always inspect the neighbors of the winner. It is the single most valuable optimization habit.
Overfitting, defined
A model that memorizes history instead of learning the market. Symptoms: spectacular in-sample results, parameter sets that no adjacent values can reproduce, and results that decay the moment market character shifts. Every parameter you add multiplies the surface area for memorization.
The cure: out-of-sample testing
The scientific protocol, used everywhere serious research happens:
- Split your data — e.g. optimize on 2020–2023.
- Freeze the parameters. Change nothing.
- Run once on unseen data — 2024–2025. No re-tuning, no peeking twice.
A strategy that holds up out-of-sample has evidence. One that doesn't was never a strategy — it was a curve fit that hadn't been caught yet.
Practical hygiene on the platform
- Optimize the fewest parameters that matter (2 is plenty; 5 is a museum of coincidences).
- Prefer parameter values backed by a reason (round-ish MA periods that traders actually watch) over "the optimizer said 17 and 43".
- Keep runs honest: note every combination tried — the true test is the final one, on data that influenced none of your choices.
- The tester rate-limits heavy runs (a handful per minute) — a natural nudge to think between runs rather than brute-force.
What optimization is FOR
Not to find "the best settings" — those don't exist outside the past. Optimization is a robustness probe: it tells you whether your edge is a plateau or a spike, and only plateaus deserve to be traded.
By the numbers
Physicist Freeman Dyson, retelling Fermi's jab, quoted von Neumann in Nature (2004): with four parameters "I can fit an elephant, and with five I can make him wiggle his trunk" — the precise trap of a multi-parameter sweep. The lesson's example grid is 5×5 = 25 runs, and the honest read is to inspect the neighbours of the winner, not the winner alone.
Practice in the simulator
Sweep two parameters and inspect the winner’s neighbors — apply what you just read with simulated money.
Check your understanding
4 questions · answer all, then submit.