Appearance

Personalize your experience

Mode
Accent Color
Direction
Walk-Forward Analysis

Walk-Forward Analysis

Backtesting

Walk-forward analysis repeats what deployment does: choose parameters on the past, trade them on a future they have not seen, move forward and choose again. Only the out-of-sample windows count.

The windows

ModeIn-sample windowUse it when
Rollinga number of bars just before each out-of-sample markets change and old is less relevant
Anchoredfrom the first bar up to each out-of-sample (it grows)the edge is structural and more helps

Each : every grid combination is backtested on the in-sample bars, the best by your is kept, and it is run on the next out-of-sample bars, starting flat. The next window starts where that one ended. With 10,000 bars, 3,000 in-sample and 1,000 out-of-sample give seven windows.

Reading the result

MeasureMeaningHealthy
Out-of-sample return per what trading would have earnedmostly positive, no single carrying the total
Profitable OOS windowsshare of windows with a profit60% or more
EfficiencyOOS return per bar / IS return per barabout 0.5 or higher; near 0 means the in-sample do not carry over
Parameter changeshow often the chosen set differs from the previous few; constant switching means the optimum is noise
!
Caution:Do not tune the walk-forward itself ( sizes, , grid) until it looks good: that is another search over the same , and the out-of-sample windows stop being out of sample.

Choosing window sizes

  • The in-sample window should hold enough for the to mean something: aim for 30 or more per .
  • The out-of-sample is how long you would trade between re-optimizations. A quarter of the in-sample length is a common start.
  • Indicator warm-up eats the start of each out-of-sample on the server (it starts flat). Very short OOS windows with long indicators trade little.

API and SDK

POST /backtest/engine/walk-forward
{ "data": { "...": "..." }, "strategy": { "...": "..." },
  "walkForward": { "inSample": 3000, "outOfSample": 1000, "mode": "rolling", "objective": "sharpe",
                   "grid": { "fast": [5, 10, 20], "slow": [40, 80] } } }
quatick.optimize.walk_forward
wf = optimize.walk_forward(strategy, bars, {"fast": [5, 10, 20], "slow": [40, 80]},
                          in_sample=3000, out_of_sample=1000, mode="anchored", n_jobs=8)
wf["oos_stats"]["sharpe"], wf["efficiency"], wf["profitable_windows_pct"]
wf["oos_equity"]   # stitched out-of-sample equity (the SDK warms indicators up on in-sample history)

See also

Related articles

  • Overfitting & Validation

    Backtesting / Validation

    Why searching for a good backtest reliably produces one even when no edge exists, how to recognise a fitted strategy, and the validation designs that…

  • The Backtesting Page

    Backtesting / Backtesting Page

    Automation → Backtesting runs any saved strategy or strategy file on the backtest engine, then lets you analyse, stress, optimize, validate, compare and…

  • Step 7 — Strategy Testing

    Automation / Strategy Builder / Wizard Steps

    The testing step offers three modes, each answering different questions about strategy behavior. Use all three in sequence: backtest to validate logic,…

  • Backtesting in Python and C++

    Backtesting / SDKs

    The quatick Python package and the header-only C++ library let you import indicators, backtest on your own machine and send the same file to Quatick.…

  • Backtesting Methodology

    Backtesting / Methodology

    What a backtest is actually evidence of, the assumptions built into it, how much data is enough, and the procedure that makes a result worth acting on.

  • C++ SDK Reference

    Backtesting / SDKs / C++

    Header-only C++20 (packages/quatick-backtest-cpp): the position simulator, an event-driven engine with the same order rules as Python, analytics, a parallel…

  • Execution Modelling

    Backtesting / Execution Modelling

    Commission, slippage, spread and fill assumptions — the difference between a backtest that means something and one that flatters. Costs are where most…

  • From Backtest to Live

    Backtesting / Going Live

    The staged path from a validated backtest to full size, what each stage can detect that the previous one cannot, and the monitoring that tells you when to stop.

  • Monte Carlo and Robustness

    Backtesting / Monte Carlo

    A backtest is one path through history. Monte Carlo asks how different the result could have been with the same edge: a different order of trades, a…

Browse all knowledge base articles →