Walk-Forward & Optimisation
Lesson 8 showed how the simulator lies. This lesson is the cure: study from past papers, but always sit a fresh exam — and when tuning, choose the wide hilltop, never the needle.
9.1The fresh exam
The tailored suit fooled us because we graded the strategy on the same data we tuned it on. The fix is old-fashioned school discipline: study from 2023's past papers all you like — but your grade comes from sitting 2024's exam, which you have never seen. Tuning data is called ; the sealed exam is .
runs this discipline on repeat: tune on window 1, test on the unseen window 2. Slide forward: tune on 2, test on 3. Again and again across years. Then — the crucial part — your verdict comes only from stitching together the exam results, never the study sessions:
9.2Optimisation — tuning without torturing
means searching for the best parameter values — should the fast EMA be 8, 10, or 14? Should the ATR multiplier be 1.2 or 1.8? Innocent question, dangerous power tool: search hard enough and you can always find some combination that aced the past. You already know that suit.
The protection is in what you pick. Plot profit against a parameter value and you'll see hills. Two kinds matter:
⚙ Pick your hilltop — then sit the exam
Drag across the whole range. In-sample, the needle at 27 beats everything — and fails the exam. Anywhere on the 35–65 plateau passes. This single picture is most of what "robust parameters" means.
9.3Searching smart — the explorer, not the surveyor
How do you find the hills at all? Grid search is the surveyor: measure every square of the map — thorough, brutally slow when there are many parameters. is the explorer: probe a few spots, build a mental map of where the high ground probably is, and spend the remaining effort in the promising valleys. Your system carries both, and an rides along on every search — the skeptical examiner who checks whether a "discovery" survives out-of-sample before it's believed.
Walk-forward: python -m python.backtest.run_walk_forward (windows, folds, stitched verdicts). Parameter search: python -m python.optimisation.run_optimise — grid or Bayesian (Optuna), reading search ranges from config/top_pairs_search_spaces.yaml, with overfitting_guard.py vetting every winner. The "top pairs sweep" runs this whole pipeline across all pairs — it's where the recommendation engine's per-pair, per-timeframe evidence comes from.
9.4What you now know that most traders don't
Nine tools, each built for one habitat, with a dispatcher choosing who works (Lesson 7).
The simulator rejects bad ideas cheaply — and lies through tailoring, peeking, free lunches, and highlight reels (Lesson 8).
Only sealed exams count: walk-forward verdicts, stitched from data the strategy never studied (Lesson 9).
And when tuning: wide hilltops, never needles — with a skeptical examiner auditing every "discovery."
That's the entire evidence chain behind one line on a recommendation card — "walk-forward tests show this strategy's highest Sharpe on GBPUSD H1." You now know precisely how much work that sentence is carrying.