Skip to main content

Documentation Index

Fetch the complete documentation index at: https://uncoded.ch/docs/llms.txt

Use this file to discover all available pages before exploring further.

Walk-forward testing is the technique that catches curve-fitting before you risk capital. Train your strategy parameters on one historical window. Validate on a different, untouched window. If the strategy holds up out-of-sample, you have evidence it’s not just overfit to history.

The curve-fitting problem

Curve-fitting is the most common backtest failure. You tune a strategy’s parameters until it produces beautiful equity on a specific historical window. The strategy works perfectly on that window because you tuned it to. Live deployment shows underperformance because the new market data isn’t the same as the data you tuned against.Symptom: backtest looks great. Live underperforms substantially.Root cause: the parameters you “optimized” are overfit to the specific noise of the training window, not to a generalizable market characteristic.Walk-forward testing prevents this by validating on data the strategy has never seen.

How walk-forward testing works

1

Split your historical window into segments

Example: 24 months of historical data, split into 6-month segments. Or 12 months split into 3-month segments. The split count depends on data availability and the timescale of your strategy.
2

Use one segment for parameter tuning

The “in-sample” or “training” segment. Iterate on your strategy parameters until you have something you’re confident in.For pre-built modes, this is typically zero tuning — the modes are pre-tuned. For SignalEditor recipes, this is where you adjust thresholds, indicator lengths, etc.
3

Validate on the next segment — untouched

The “out-of-sample” segment. Run the same parameters (no further tuning) against this window. See if the strategy works.Key principle: do not look at out-of-sample results until you’ve finalized your parameters on the in-sample segment. If you peek and adjust, you’ve contaminated the test.
4

Walk forward — slide the window

Move forward in time. The previous out-of-sample becomes the new in-sample (you can re-tune slightly with new data). The next segment becomes the new out-of-sample.Continue until you’ve covered the full historical window.
5

Aggregate the out-of-sample results

The cumulative out-of-sample equity curve is your true test. It represents how the strategy would have performed in the gap between when each tuning could have happened and when the next data arrived.

A worked example

You want to test BasicMode with custom sell-ladder rungs on BTCUSDT.
  • Total historical window: Jan 2023 – Dec 2024 (24 months).
  • Segment size: 6 months (4 segments total).
  • Iteration goal: validate that custom sell-ladder shape holds up across regimes.
Run BasicMode with various sell-ladder configurations. Find the one with the best in-sample result.Say you settle on [0.5, 1, 2, 3, 4, 5, 7] (slightly wider than the default).
Run the same [0.5, 1, 2, 3, 4, 5, 7] configuration against Jul-Dec 2023 data. Don’t peek at the result while tuning.Then look. Did it perform similarly to Segment 1? If yes, you have evidence the parameters generalize. If no, you over-tuned to Segment 1’s specific noise.
Optionally re-tune your parameters using the larger combined window. Maybe [0.5, 1, 2, 3, 4, 5, 7] still wins, or maybe a slightly different shape.
Same procedure. Run the (re-)tuned parameters against the new untouched window.Continue this walk-forward until you’ve covered all 24 months.
The cumulative result of all out-of-sample segments tells you what live operation would have looked like during this period. This is your “honest” backtest result — uncontaminated by future-knowledge in tuning.If aggregate out-of-sample looks like the in-sample tuning predicted, you have a robust strategy. If aggregate out-of-sample is much worse, you’ve identified curve-fitting.

When walk-forward is essential

Especially custom strategies with several tuning knobs (RSI threshold, trend-filter EMA length, trigger-mode choice). The combinations multiply quickly; without walk-forward, overfitting is likely.
If you’re changing BasicMode’s sell-ladder shape, stop-loss percentage, or other parameters from default, walk-forward validates the tuning isn’t just curve-fitting.
“BasicMode on XRPUSDT doesn’t work great with default parameters; let me tune them for XRPUSDT specifically.” Walk-forward catches if your XRPUSDT-tuned parameters actually transfer to live XRPUSDT operation.
Any time you’re adjusting >2 parameters simultaneously, the curve-fitting risk multiplies. Walk-forward is essential.

When walk-forward is less critical

If you’re running BasicMode with all defaults, you’re not tuning. The mode was pre-tuned by the unCoded team. A simple multi-window backtest is sufficient — walk-forward adds modest value.
“I want to tighten the stop-loss from -20% to -15%.” This is a single parameter change motivated by risk tolerance, not by performance optimization. Walk-forward isn’t strictly necessary; multi-window backtest is sufficient.
Switching from BasicMode to FullBullMarket isn’t tuning — it’s a different strategy entirely. Compare the two side-by-side, but you don’t need walk-forward for the comparison itself.

Practical considerations

Segments should be large enough to contain meaningful sample size but small enough that you can do multiple walk-forwards.For most operators:
  • Strategies with ~10 trades/month: segments of 3 months give ~30 trades per segment.
  • Strategies with ~30 trades/month: segments of 1 month give ~30 trades per segment.
  • Strategies with ~5 trades/month: segments of 6 months give ~30 trades per segment.
Aim for ~30 trades minimum per segment.
The hardest discipline of walk-forward testing. Once you’ve tuned on in-sample, you must validate on out-of-sample without further adjustment.If you peek, see poor result, then “adjust slightly” — you’ve contaminated the test. The out-of-sample window is no longer untouched.Operator habit: tune in-sample, write down your final parameters, THEN run out-of-sample. Don’t even open the out-of-sample chart during tuning.
Some walk-forward variants re-tune on every step (using all prior data). Some keep parameters fixed across the walk-forward.For most operators: tune once on segment 1, validate on subsequent segments without re-tuning. If parameters don’t hold, the strategy isn’t robust enough — re-tuning to “fix” it is dilution.
A useful technique for reducing personal bias: have someone else look at the in-sample-tuned parameters and validate the choice before you run out-of-sample.A second pair of eyes catches “I’m tuning toward what I want to see” patterns that you can’t see yourself.

Best practices

  • Use walk-forward for any non-trivial parameter tuning in custom strategies.
  • Aim for ~30 trades per segment as minimum statistical sample.
  • Don’t peek at out-of-sample during tuning — discipline is the value of the technique.
  • Keep parameters fixed across walk-forward — re-tuning to “fix” dilutes the test.
  • Validate on at least 2 out-of-sample segments before going live — single-segment validation can be coincidence.
  • Forward-test on small live capital even after walk-forward succeeds — the ultimate test.
  • Document your walk-forward results — operator runbook entries help future-you understand past decisions.
  • Don’t use walk-forward to justify aggressive strategies — if it requires complex statistical proof, it may be too aggressive for production.

What’s next

Why backtest

The fundamentals of backtesting motivation.

Reading results

Interpreting backtest output.

Shadow mode

Forward-testing methodology after backtesting.

Common mistakes

Including curve-fitting and how to avoid it.

Backtester module

The module that runs walk-forward tests.
Last modified on May 3, 2026