Walk-Forward Optimization

    Run your first walk-forward with exact settings, then read the result in a fixed order

    The short version
    1. File → Save Optimization Settings As, then right-click the Walk-Forward section → Reset To Default
    2. Set GA Generations 120, GA Population 120 and Nearest % 60. Leave everything else
    3. Right-click the system's arrow → Run Walk-Forward → Genetic Algorithm (Multi-Threaded)
    4. Read the result: brown curve, then profit factor, average trade and net profit
    5. Check the numbers: anchored stability above 40, rolling stability 62 or more, WFE above 60%

    Why walk-forward matters

    GSB's genetic algorithm searches a huge number of systems. Some will look great on past data purely by luck. That's over-fitting, and an over-fitted system tends to fall apart on new data. The only fair test is data the optimiser never saw.

    A walk-forward does three things. It optimises the system's parameters on a past segment of data (in-sample). It tests those parameters, unchanged, on the data that comes straight after (out-of-sample). Then it moves forward and repeats. Trademaid's beginners' guide says GSB divides the data into 10 segments, so this happens 10 times.

    Trademaid's walk-forward test procedure: each row is one run, with in-sample data in cyan and out-of-sample data in dark blue

    Each row is one run. Cyan is in-sample (optimised), dark blue is out-of-sample (tested unchanged). Here the in-sample part starts at the beginning and grows: that's anchored, the setting you'll use

    Put end to end, the dark blue pieces cover a long stretch of history, and every piece was traded with parameters chosen before that period. GSB calls this joined-up result WF OOS. Trademaid expects real-time trading to look more like WF OOS than like the original backtest. So your main job after a walk-forward is checking that WF OOS holds up.

    Why not just hold back one block of data at the end? Do that too. But one split gives one result from one market period, and it might be lucky or unlucky. Walk-forward tests many periods, the way you'll re-optimise in live trading.

    Be realistic. Walk-forward reduces the risk of trading an over-fitted system. It doesn't remove it. Make sure slippage and commission are realistic, and treat walk-forward as one layer of checking. The others are on the Validation and Robustness page.

    Your first walk-forward, click by click

    Before you start

    • You need a system you've already built. It's listed in the Unique Systems tab
    • Walk forward one system at a time to start
    • Check your RAM. Trademaid says multi-threaded walk-forward will probably need 16 GB. With 8 GB or less, use Single-Threaded and run one walk-forward at a time

    Step 1: Save your settings

    Click File → Save Optimization Settings As and give the file a name you'll recognise. This saves everything in the left panel. If anything changes by mistake, get it back with File → Load Optimization Settings.

    Step 2: Reset the Walk-Forward section

    In the left panel, scroll down to the Walk-Forward section. Right-click one of its rows and choose Reset To Default. Trademaid notes the defaults may not be fully up to date, so check each row against the table below.

    Trademaid's help says to right-click the left panel and click Reset To Default. It doesn't say whether this resets only the section you right-click or every setting, including Data and Trading Periods. That's why Step 1 saves your settings first. Check Trademaid's current help.

    Step 3: Change three numbers, leave the rest

    Go down the Walk-Forward section one row at a time. Only three numbers change:

    • GA Generations: type 120
    • GA Population: type 120
    • Nearest %: type 60. Many screenshots show 50, so check you've really typed 60

    Trademaid uses 120 x 120 for a three-indicator system. If your system uses four or five indicators, use 150 for both. Treat 100 x 100 as the floor: very low values (Peter mentions 5 generations) make a walk-forward meaningless. Everything else stays on its default. The full row-by-row list is in the settings table below.

    Walk-Forward settings with GA Generations 120, GA Population 120, OOS % 20, Runs 10 and Nearest % 60

    Trademaid's beginners' guide settings: GA Generations 120, GA Population 120, OOS % 20, Runs 10, Nearest % 60 (boxed). Your version may show more rows, or a different # of Random-Space Tests. That's fine

    Step 4: Check the Data rows and dates

    In the Data section, leave WF Price Data and WF TPD blank, and Optimize WF Price Data on False. Leave your Trading Periods alone too. Walk-forward uses the global start and end dates, and your Nth day settings, from that section.

    Step 5: Right-click the system's arrow

    Click the Unique Systems tab and click your system's row. A small black arrow shows at the far left of that row. Right-click exactly on that arrow. Trademaid is clear: right-click the arrow, and nowhere else.

    Step 6: Run Walk-Forward → Genetic Algorithm (Multi-Threaded)

    In the menu, hover over Run Walk-Forward. A coloured list opens. Click the first item, Genetic Algorithm (Multi-Threaded). With 8 GB of RAM or less, click Genetic Algorithm (Single-Threaded) instead. Ignore the other items for now.

    Right-click menu with Run Walk-Forward open, showing Genetic Algorithm (Multi-Threaded) at the top of the list

    Run Walk-Forward → Genetic Algorithm (Multi-Threaded) is the first item. The WF to EWFO and @ Best Worker items are for later

    Step 7: Watch the WFS column

    The walk-forward runs in the background. The WFS (walk-forward status) column shows the percentage done, then Complete when it's finished. The Walk-Forward tab shows how many systems have been walked forward. Be patient, and don't start lots of walk-forwards at once: Trademaid warns there's no protection in GSB to stop them using up your RAM.

    Your version may show a few more rows or menu items than the screenshots here (for example, whether Anchored and Search Space only show in advanced view, or which Optimize rows appear). Check Trademaid's current help.

    Walk-Forward settings: what to use

    Everything in the Walk-Forward section, top to bottom, for your first walk-forward.

    SettingUse thisDefaultWhat it does
    TypeNothing to setGreyed outGreyed out, so there's nothing to set here. You pick the walk-forward from the right-click menu
    # of Random-Space TestsLeave10,000 in Trademaid's newer screenshots (90,000 in some older ones)Only used by a Random Space walk-forward. You'll use Genetic, which Trademaid says is the default method
    GA Generations120May show 100How many generations the genetic walk-forward runs. Use 150 if your system has 4 or 5 indicators. 100 is the minimum: too few generations lower stability and make identical walk-forwards disagree
    GA Population120May show 100How many systems in each generation. 120 x 120 is about 14,400 tests. Use 150 for 4 or 5 indicators. Don't go below 100 x 100. The Enhanced Walk-Forward Optimizer can't change these, so set them here first
    AnchoredLeave on TrueTrueTrue means the in-sample part always starts at the beginning and grows. False is a rolling walk-forward (later). GSB systems consistently do better anchored. Rolling is a harder stress test, Peter doesn't use its final parameters, and it suits systems with few trades poorly
    OOS %Leave20The share of bars kept out-of-sample. Trademaid: best left on the default
    RunsLeave10The number of walk-forward runs. Trademaid: best left on the default. Peter Zwag (GSB's developer) never uses anything but 10. Don't walk one run forward into another 10
    Search SpaceLeave on NearestNearestNearest walks forward around the system's existing parameter values. Full uses the whole range GSB allows (later)
    Nearest %6050 in many screenshotsHow far around the original parameters to search. At 60, GSB searches 30% above and 30% below
    Optimize Data Streams, or Optimize Stop-Loss and Optimize Profit-TargetLeave on FalseFalseData streams: for optimising price data, not needed yet. Stop and target: Trademaid mildly recommends not optimising them, as they have little effect
    Data section: WF Price Data, WF TPDLeave blankBlankBlank means GSB uses your normal optimisation price data. Trademaid calls these rows experts only
    Data section: Optimize WF Price DataLeave on FalseFalseExperts only
    Trademaid's screenshots disagree on some factory defaults (GA Generations and Population 100 or 120, Nearest % usually 50, # of Random-Space Tests 10,000 or 90,000). The values in the "Use this" column are the ones to type, whatever your default shows. Check Trademaid's current help for the current defaults.

    Reading your result

    When the WFS column says Complete, click that system's row (in the Unique Systems or Walk-Forward tab), then click the Graphs tab. You'll see the equity chart with the walk-forward lines added, and a small table underneath.

    Know your lines

    • Opt. Training (red) and Opt. Test (green): your original system, with the parameters it was built with
    • WF OOS (brown): the joined-up out-of-sample result
    • WF Current (yellow): the final walk-forward parameters, the ones that work best over the whole period. Trademaid says this is the version used for live trading

    For the checks below, you're mainly comparing brown against red and green. A few things Peter Zwag (GSB's developer) looks for:

    • WF Current is nearly always higher than WF OOS. That's normal, because it uses the best parameters with hindsight
    • He hopes to see the curves running parallel over the last third of the chart. An offset early on is normal
    • If the last 3 runs (in the Walk-Forward tab) have the same parameters, confidence is high
    • When he takes a system live, he exports the WF version of the code with Use WF Current Params, "at all times"

    Check in this order

    1. The brown curve. Pass if it sits at or above the original red and green curves, rises in a fairly straight line, and runs roughly parallel to them. If the walk-forward curves drift further and further apart over time, Trademaid's case study advice is to reject the system and move on. Don't try to rescue it by changing settings.
    2. Profit factor (P Fact column). Pass if WF OOS is as good as or better than Opt. Best Training. If it's clearly lower, look much harder at the system.
    3. Average trade. Pass if WF OOS is as good as or better than the original. It must also be high enough to cover brokerage and one tick of slippage on each side, and more for illiquid markets.
    4. Net profit and number of trades. A small drop in net profit is still acceptable when profit factor and average trade improve. But beware if the number of trades doubles or triples out-of-sample.

    For checks 2 to 4, compare two rows in the table under the chart: Opt. Best Training (the original system) and WF OOS. Ignore the WF Current row for these checks. In Trademaid's beginners' guide example, profit factor rose from 2.27 to 2.54 and average trade from about $108 to about $142, while net profit dipped from about $42,500 to about $41,000 and trades fell from 394 to 288. Trademaid calls a result like that very acceptable. These are past, hypothetical results, and they don't guarantee future performance.

    Older walk-forward chart with the Opt. Best Training, WF Current and WF OOS rows in the table underneath

    The table under the chart: compare Opt. Best Training with WF OOS. This older screenshot (built on three bar sizes) draws WF OOS dark green and WF Current light green; current versions and Trademaid's help use brown and yellow

    In newer versions the top row may be called Opt. (Avg.) instead of Opt. Best Training, and the original system may show as a single red training line. Exactly what Opt. (Avg.) averages isn't confirmed yet. Check Trademaid's current help.

    Run it again, and stay honest

    • Run the identical walk-forward a second time. If it gives a fairly different result, you need more iterations: raise GA Generations and GA Population, for example to 150 each
    • For a final check on a system you like, keep raising them until repeated walk-forwards agree. Peter has used 300 x 300 for a 3-indicator system, and more for 4 or 5 indicators or with Optimize Data Streams
    • Changing the stop, the number of indicators, the secondary filter or the primary indicators needs a rebuild (and a new walk-forward). Changing only how you select doesn't: re-run a macro on a favourites list instead
    • Don't keep changing settings until the brown line looks good. That quietly turns your out-of-sample data into in-sample data
    • Keep notes on what you kept, and why
    Your pass/fail scorecard
    • Brown curve at or above the original, fairly straight, roughly parallel: pass
    • Profit factor and average trade as good or better: pass
    • Average trade covers brokerage and slippage
    • Small net profit drop: OK. Trades doubling or tripling: not OK
    • Curves drifting further apart over time: reject

    Stability and efficiency: the numbers

    GSB also gives every walked-forward system some scores. You'll find them in two places:

    • The box in the top left of the chart (Graphs tab): Params. Rol. Stab. and Params. Anc. Stab., short for rolling and anchored parameter stability. Newer versions add the word Coarse. You'll also see Equity Bollinger. Leave that one for now
    • Columns in the results grid: PRS (rolling stability) and PAS (anchored stability), called PRS-C and PAS-C (the coarse versions) in newer builds, plus WFE (walk-forward efficiency). Click a column heading to sort by it

    Parameter stability

    Trademaid's logic: in a good system, the best parameters are found quickly and stay as stable as possible across the walk-forward runs. If a parameter keeps jumping around, the system is less likely to be robust.

    • Anchored stability checks how close the final parameters (the last row of the Walk-Forward tab) are to every earlier row. If the last row jumps a long way, anchored stability can drop to 0 even when the earlier rows look steady
    • Rolling stability checks how close each parameter set is to the one before it
    • The coarse versions (Astab-C and Rstab-C, shown as PAS-C and PRS-C) treat a move of under about 10% as stable. A length going from 99 to 100 counts as stable, but 9 to 10 doesn't. They ignore weights, entry levels and secondary filter levels
    • A parameter at the edge of its range early in the walk-forward is a minor issue. At the end, it's critical: the best value may lie outside the range
    • Never fix parameters just to raise stability. Fixed parameters inflate the score

    The higher the better. Trademaid's beginners' guide says an anchored stability above 40 is best. In Trademaid's Proving the Methodology test, keeping only systems with anchored stability of 40 or more improved most of the out-of-sample figures, and anchored did mildly better than rolling. For rolling stability, Trademaid's glossary prefers 62 or more.

    Walk-forward chart with Params. Rol. Stability 76 and Params. Anc. Stability 70, all four curves tracking closely

    Pass: rolling 76, anchored 70. All four curves track each other closely

    Walk-forward chart with Params. Rol. Stability 44 and Params. Anc. Stability 20

    Caution: rolling 44, anchored 20. The curves rise nicely, but the parameters moved a lot, so it doesn't pass on stability

    To see why a score is high or low, open the Walk-Forward tab above the chart. Each numbered row is one run, with its parameters. Trademaid likes the parameters to be stable in roughly the last quarter of runs.

    Walk-Forward tab listing each run's parameters, with the first parameter settling at 136 from run 4

    Walk-Forward tab: the first parameter settles at 136 from run 4, and the rest from run 5, through to the Current row. Rolling 90, anchored 80

    Walk-forward efficiency (WFE)

    WFE is the annualised return of the out-of-sample results divided by the annualised return of the in-sample results. 100% means the out-of-sample periods earned at the same yearly rate as the optimised periods. Trademaid's rough guideline is WFE above 60%. Over 100% can happen. It's fine, but it isn't automatically better, so still check the curves and the table.

    Peter puts far more weight on parameter stability than on WFE. In his tests, out-of-sample results rose in direct proportion to walk-forward stability. He has called WFE "almost useless", because it ignores how good the market was in each period. The WFE custom metric in the grid never worked properly. From build 65.41, use a WFE filter in a macro instead.

    Read the scores sensibly

    • The coarse scores allow small changes. If a moving average length moves from 99 to 100, the normal score drops but the coarse score doesn't
    • Anchored stability works poorly with a rolling walk-forward, one more reason to stay anchored for now
    • The scores slightly favour systems with fewer parameters
    • If the parameters vary but the curves stay very similar, Trademaid says that's still a good thing
    Your numbers scorecard
    • Anchored stability (PAS): above 40
    • Rolling stability (PRS): 62 or more
    • WFE: above 60%
    • Parameters steady in roughly the last quarter of runs
    • Plus the four checks from Reading your result

    Trademaid calls these guidelines, not guarantees.

    Not confirmed yet: whether GSB's WFE column uses exactly the same calculation as the Enhanced Walk-Forward Optimizer, how the stability scores and coarse tolerance are calculated, and whether the 40 and 62 thresholds apply to the coarse (PAS-C, PRS-C) versions. Check Trademaid's current help.

    How many walk-forwards, and where

    • Walk forward a few members of each family, not your top 250 systems. Peter: with families you should only have about 2 to 15 unique systems that need a walk-forward. He says walking forward by macro is "not part of the methodology"
    • A local manager runs 4 walk-forwards at once and queues the rest. App Settings sets the cores and the number of concurrent walk-forwards. Single-Threaded finishes a batch sooner than Multi-Threaded
    • Cloud walk-forwards can end as CanceledLost if the cloud worker stops (for example, it was closed or lost its internet connection). Save the systems, load them in a new manager and walk forward again
    • There's a hard limit of 1,000 walk-forwards in the system at once. If walk-forwards stall, restart Resource Manager and all workers
    • Set Nth day to All before you walk forward
    • If a system was built with an MFE or NPLateEntry fitness, walk it forward with NP x Avg Trade. Those fitnesses can mislead a walk-forward
    • Walk-forwards run on your workers, not the manager, so the manager stays responsive. GSB gives walk-forward jobs to the worker with the most free CPU and RAM first
    • Going further by hand: Peter re-optimises some systems himself, one input at a time, then walks them forward in the Enhanced Walk-Forward Optimizer. It's optional and slow; the outline is in EWFO Documentation (Running Walk-Forward Tests)

    Next steps

    A system that passes these checks has earned a closer look, not a guarantee. Next, run the robustness checks on the Validation and Robustness page. It also lists the advanced walk-forward options (rolling, Full search space, Random Space, the Enhanced Walk-Forward Optimizer) for later.

    When a system is ready to trade, export it to your platform. Trademaid's help notes that if you have done a walk-forward, the WF tab code should have better settings than the Optimization tab. Right-click → Cancel Walk-Forward stops a walk-forward that's running. For every panel and column, see the Interface Reference.

    GSB's main tools are its genetic algorithm search, its walk-forward and robustness tests and its export to TradeStation, MultiCharts and NinjaTrader. New to it? See what Genetic System Builder does and how GSB compares with StrategyQuant and Build Alpha.