ValidationIntermediate24 min read

Retraining is not a fresh start: design a walk-forward you could actually run

Design a reproducible walk-forward with explicit windows, mature labels, fitting frequency, model versions and position continuity.

The calendar says it is time to retrain. The file already contains the latest candles, but the outcomes of three recent decisions remain unknown. While the new version is fitting, a position stays open under the previous version’s rules. The validation chart shows only training and evaluation rectangles; it says nothing about what to do with any of this.

A walk-forward is often presented as moving a window, training, and testing the following segment. The idea is useful, but incomplete as an operational specification. What is evaluated is an update rule unfolding through time, with its available information, delays, states, and selection decisions. A succession of models does not automatically become an executable strategy.

This article builds that procedure step by step. Every calendar, result, and quantity is a hypothetical educational example, unrelated to Atlas results or expected robot profitability. The initial context is Forex; numerical indices represent ordered observations rather than market days for a promised instrument.

The question is not whether frequent retraining looks more intelligent. It is which information authorizes each update, what actually changes, and how to interpret a path made from successive versions without erasing costs or uncomfortable decisions at their boundaries.

1. Evaluate the procedure producing the models

A fixed model is fitted once and retains its parameters throughout a defined period. A walk-forward procedure specifies several fitting times and a rule for subsequently using each version. It may incorporate internal parameter selection, but that selection must also remain restricted to information permitted at each time.

The rolling-origin evaluation described by Hyndman and Athanasopoulos constructs forecasts from successive origins using earlier observations. It provides a conceptual basis for respecting temporal order; applying it to trading requires adding decisions and execution. Hyndman and Athanasopoulos, rolling-origin evaluation.

Imagine a recipe that takes an authorized dataset every twenty observations, fits its transformation and model, checks criteria, and activates a version. That recipe, rather than the parameter file produced on a Tuesday, is the experiment’s stable object. Parameters can vary while the procedure remains fixed.

Retraining does not authorize redesigning the recipe after every result. If a bad segment leads you to expand the window, change features, and choose another frequency, the procedure has changed. This may be reasonable research, but the observed segment participated in the decision and should no longer be presented as untouched evaluation of the final design.

Before testing, write down what remains fixed: candidate features, objectives, model family, selection rules, calendar, costs, and activation conditions. Also state what each update may learn: coefficients, transformation means, or parameters chosen within an authorized internal search. This separation prevents calling every improvised change adaptation.

The final result should answer a concrete question: had we followed this recipe at the intended dates with the available information, which decisions would it have produced? It does not establish what will happen afterward, but offers a reconstruction another person can review without guessing why the model changed.

2. Expanding and rolling windows remember different histories

An expanding window preserves its beginning and adds observations at each update. A rolling window retains a defined length and discards its oldest observations as it advances. Neither is universally superior. They express different choices about how much history should retain influence and how much material is needed for stable estimation.

Suppose the first fit considers observations 1 through 60 as its candidate segment. Twenty observations later, an expanding window considers 1 through 80; a rolling window of sixty considers 21 through 80. Before discussing available labels, a difference is already visible: the latter removes the first twenty observations while the former preserves their influence.

Discarding history and adapting are not synonyms. A short window may respond more strongly to recent observations, but can also produce more variable estimates or retain too few relevant examples. A long window may stabilize some estimates while mixing different conditions. The choice needs justification connected to the research question, rather than a retrospective story fitted to the winner.

Count usable observations, not merely candidate rows. Missingness, indicator warm-up, still-open labels, and quality rules can reduce the actual dataset. Two windows with sixty calendar rows may contain very different numbers of learning opportunities. Record this reduction to interpret changes between versions.

Also distinguish elapsed duration from event count. Sixty trades can span an active week or several quiet months. An event-based window preserves a quantity of examples but changes its historical horizon; a calendar window preserves duration but not quantity. When signal availability varies, that difference can dominate fitting behavior.

A reasonable comparison begins with a few justified alternatives and retains a fixed reference. Choosing among dozens of lengths after viewing the complete path makes the window another selected parameter. Walk-forward results are not protected merely because their individual training sets are ordered.

Moving from observation sixty to eighty, the expanding window retains one through eighty and the rolling window uses twenty-one through eighty.
The policies change which part of the past can influence the next version.

3. A recent row can have a still-future label

Define an educational label for observation t: it depends on the next three intervals and becomes known at the close of t plus three. We fit immediately after observation 60 closes. Features in row 60 may exist, but its label requires reaching 63. It is unavailable for training at that cutoff.

The last row with a completed label is 57, because 57 plus three equals 60. Rows 58, 59, and 60 require later information. If the candidate segment was 1 through 60 and there are no other exclusions, fifty-seven rows have mature labels. The first evaluation begins at 61 under our calendar.

The feature date is not the date its answer finishes. This matters for future-return labels, trades lasting multiple intervals, and any target requiring an observed outcome. Ordering rows by entry date and training on every row before the cutoff can include answers that had not finished yet.

At the second fit, after close 80, a candidate rolling window from 21 through 80 retains mature labels from 21 through 77: again fifty-seven rows. Rows 78 through 80 wait. The next evaluation uses decisions 81 through 100. The exclusion is defined through knowledge time, rather than a decorative gap in the diagram.

A fixed margin works only if it represents the actual dependency. When every label takes exactly three intervals, excluding three final rows can represent this example. If some positions last two intervals and others ten, a single margin requires another justification or should be replaced by per-observation availability checks. A declared maximum, realized duration, and shared-information period are not identical concepts.

Furthermore, a completed label can arrive with processing delay. Our example assumes availability at the close that completes it. If the process needs additional time, move the effective cutoff or delay activation. Calendar precision must match the speed at which the robot intends to learn and decide.

At close sixty, row fifty-seven's label has finished; rows fifty-eight through sixty remain immature.
A row preceding the cutoff is insufficient if its outcome depends on later observations.

4. A gap between blocks needs an explained purpose

Temporal gaps can prevent particular dependencies between training and evaluation, but they are not universal certificates. Their length must address horizons, overlaps, and availability. An arbitrary five-row pause can be excessive for one question and insufficient for another.

Scikit-learn’s TimeSeriesSplit provides a gap parameter excluding samples at the end of training before testing. Its documentation also notes the regular spacing needed for comparable block durations. These are partitioning tools, rather than automatic label audits. scikit-learn, TimeSeriesSplit.

In our example, the three omitted rows have a clear justification: their labels have not matured. This does not mean they must be deleted forever. They may enter a later training set when their outcomes become known and they remain inside the permitted window. Exclusion belongs to a cutoff, rather than a permanent quality judgment.

A separation should be explainable in the problem’s units. If you use rows, check how much time they represent. If you use hours, check how closures and gaps affect them. If you use label intervals, preserve their individual boundaries. The drawing can be simple, but its generating logic must not rely on hidden regularity assumptions.

Also review feature warm-up at the beginning of each window. A twenty-observation average may need history preceding the first trainable row. Using earlier history to construct that feature can be admissible when it was available; it does not mean every contextual row must participate in fitting. Distinguish context for constructing inputs from examples used to learn parameters.

Finally, a gap cannot repair transformations calculated globally before splitting. An imputation mean learned over the entire sample still leaks future information even when ten empty rows separate the rectangles. The article on imputation and future information explains how to verify that layer separately.

5. Fitting frequency changes the evaluated object

Updating every twenty observations and updating every sixty are different procedures. Frequency determines how long a version remains active, how often new observations are incorporated, and how much operational work the recipe requires. It is not a reporting preference.

Frequent updates may react sooner to new information, but can also increase variability, computation cost, and position changes. Less frequent updates may leave a version active under conditions differing from those that produced it. These are design possibilities, rather than claims that one rhythm produces better results in a particular market.

The update calendar is chosen before the segment it will govern is known. You can study multiple frequencies during development, but must acknowledge comparing them. Do not retrospectively choose for each block whichever fitting date proved most convenient and present the mixture as though a preexisting rule produced it.

Suppose an operating period permits twelve monthly fits or four quarterly fits. The first option triples the number of processes, but does not necessarily triple total cost or useful new information. Each fit may reuse observations and require checks of different durations. Count resources and actual changes, rather than calendar events alone.

More frequent retraining does not create more independent evidence. Successive windows often share much of their data, and evaluation blocks can be affected by related conditions. Saving many models is not equivalent to observing many independent experiments. The report should avoid implying otherwise.

If an update is triggered by an alert instead of a fixed date, specify the alert, its inputs, and its delay. You are now evaluating an event-conditioned policy. The detector can also be selected or overfitted, and its false alarms belong to the operational behavior that must be counted.

6. Refit the complete pipeline as an identifiable version

A model receives transformed inputs. If its coefficients change while an incompatible scale remains, or imputation changes without a recorded version, you no longer know which procedure produced each prediction. Store together the components determining representation and decisions.

For every cutoff, identify the authorized dataset, cleaning parameters, transformations, model, thresholds, and execution rules. Some elements can remain fixed by design; others are fitted. The version must state which. Complex infrastructure is not required to understand this: clear records and distinguishable files already enable much of the chain to be reconstructed.

An incremental update is not always equivalent to fitting from scratch. It may preserve state and depend on batch order, learning rate, and previously seen observations. Scikit-learn documentation distinguishes algorithms supporting incremental learning through partial_fit; not every estimator supports that mode. scikit-learn, incremental learning.

If the recipe says “the last sixty observations” but an incremental model retains influence from all previous ones, you have not automatically implemented a sixty-observation rolling window. Demonstrate how old information is removed or limited, or describe a procedure with different memory. Naming a window parameter does not erase learned state.

Review random state where relevant too. Saving a seed helps reproduce some executions, but does not eliminate selection variability or guarantee equality across environments and algorithms. If the result depends strongly on that variation, investigate it within authorized development and avoid choosing a seed because it produced the most attractive curve.

A useful version also retains fitting start time, completion time, and activation time. These can differ. A model finishing at 10:05 cannot govern a decision at 10:01 unless the experiment declares an idealization incompatible with that actual computation time.

7. Internal selection does not authorize looking outside

You can choose parameters through internal validation contained within information available at each cutoff. The outer procedure then evaluates the complete selection-and-fitting recipe. This permits studying a system that periodically selects models, but requires distinguishing which observations guide selection from those measuring subsequent decisions.

Cawley and Talbot document the risk of overfitting a selection criterion: selection can exploit variation in an estimate, not merely parameter fitting. Their work explains why a validation metric is not immune to repeated search. Cawley and Talbot, overfitting in model selection.

Outer evaluation stops being untouched when it decides the next redesign. Learning from results is normal, but the revised procedure then needs an evaluation acknowledging that learning. Renaming a block out of sample is insufficient if its behavior already changed features or calendars.

Imagine comparing two window lengths and two frequencies using the complete outer path. You have compared four recipes. The best should not be interpreted as though it were the only one specified from the beginning. The number of temporal blocks does not cancel selection among procedures.

A practical option limits alternatives, records their justification, and preserves a later phase for the chosen recipe. Another reports the study as exploratory without turning the selected figure into a neutral estimate. The choice depends on objectives and available data; neither can declare a consulted history untouched again.

The article on manual searches and selection explores those decisions further. They deserve particular attention in walk-forward studies because an orderly temporal diagram can create a sense of rigor concealing how often the recipe changed after its results were examined.

8. Changing models does not magically close a position

Suppose a position opens under version A at observation 79 and remains open when version B activates at 81. Decide which rules manage it from that moment. Preserving its original exits, transferring management, and closing before reevaluation are different policies with different costs and exposures.

An evaluation boundary is not a market order. Restarting every block with a flat account can conceal trades crossing the boundary. If the design requires closing when the version changes, represent that close and its costs. If continuity is permitted, retain the state required for the position to survive the change.

One simple policy assigns each trade its originating version and preserves its exit rules until completion. The new version governs only new entries. Another permits revising open positions under explicit rules. Neither is universally correct; what matters is that the policy does not change retrospectively according to which produces the best boundary result.

Shared states also continue between blocks. Daily limits, available capital, pending orders, and trade counters can affect the next decision. Resetting them to simplify code evaluates a sequence of separate experiments, rather than necessarily one continuous procedure.

Pay attention to size changes. If the new version proposes a different exposure for an existing position, the difference may require an additional trade rather than a relabeling. Record the quantity bought or sold and the conditions involved. A model update does not provide free execution.

A useful test deliberately places a position across the cutoff. Compare the expected state sequence with the simulator’s log. If the position disappears, duplicates, or changes rules without an identified event, repair the transition before interpreting the aggregate result.

A position opened by version A crosses version B's activation and retains an explicit management policy.
The new version needs a handover protocol, rather than a silent account reset.

9. Join a capital path, not isolated percentages

If the blocks form a continuous procedure, their accounting must respect that continuity. Adding percentage returns can produce a different number from compounding. Resetting capital in each block and then joining monetary gains can also mix incompatible exposures.

Take initial capital of one hundred and three hypothetical returns already net of costs included in the exercise: plus ten percent, minus five percent, and plus eight percent. Capital becomes one hundred ten, then one hundred four point five, and finally one hundred twelve point eighty-six. The cumulative return is twelve point eighty-six percent, rather than thirteen.

The arithmetic sum of ten minus five plus eight is thirteen, but it does not represent the same reinvested path. The simple average is approximately four point thirty-three percent per block, a different description that also cannot replace the cumulative result. Every metric needs a capital and horizon definition.

Hypothetical point Capital
Start 100.00
After +10% 110.00
After −5% 104.50
After +8% 112.86

At these boundary points, we observe a five-percent decline from one hundred ten to one hundred four point five. We cannot claim that this is the complete path’s maximum drawdown without knowing movements inside the blocks. A periodic-results table can conceal larger intermediate declines.

If the strategy uses fixed size without reinvestment, explain that convention and use consistent accounting. If it combines robots or changes exposure, preserve quantities and the capital base. Do not choose whichever formula makes the number look most impressive; the result must follow from the described operating procedure.

Also preserve decisions producing no trade and periods when fitting prevented action. A block without trades does not disappear from the calendar. Inactivity belongs to the procedure’s experience and affects interpretation of rates, coverage, and opportunity frequency.

Starting capital of 100 grows to 110, falls to 104.50 and finishes at 112.86 after compounding three blocks.
The compounded path ends at +12.86%; the boundaries do not reveal every decline within a block.

Forecast blocks can overlap when the origin advances less than the evaluated horizon. Imagine one version produces decisions for rows sixty-one through eighty, and the next for seventy-one through ninety. Rows seventy-one through eighty occur twice. Adding both evaluations as though they describe one account duplicates opportunities, unless the design actually trades two simultaneous components with defined sizes and costs.

Choose a usage policy before joining the path. You can use the most recent already-active version for each decision, retain one version for a fixed period, or combine predictions under an explicit rule. Each policy produces a different object. A table comparing forecast errors by horizon can retain multiple predictions for one date, but needs keys distinguishing origin, horizon, and target. Such a table is not automatically an operating portfolio.

Also verify that concatenating files neither omits nor duplicates events. Count opportunities by temporal identity and instrument where appropriate, then reconcile state transitions. A smooth curve can conceal small duplications distributed across many cutoffs. Reconciliation should work from original decisions before summarizing them as percentages or charts.

10. One bad window does not diagnose market change

An unfavorable segment may reflect variation, few trades, costs, data problems, implementation errors, or a change in the studied relationship. The aggregate result does not automatically identify the cause. Retraining after every loss can obscure diagnosis and multiply decisions that are difficult to evaluate.

First compare the procedure with references sharing data, opportunities, and costs. A fixed version asks what updating contributes. A simple rule can reveal whether the problem affects the whole decision family. A no-trade reference helps interpret net losses without turning a relative comparison into an obligation to deploy the winner.

Distinguish execution failure, data change, and predictive deterioration. If the new version received an empty column or an incompatible scale, its poor result does not establish market change. If costs increased and every reference deteriorates, the explanation may lie outside model fitting. Investigate before changing the recipe.

Report block results alongside opportunity counts, trades, abstentions, and sample composition. A percentage based on five trades has a different context from the same percentage based on five hundred. Do not use this contrast to declare statistical certainty automatically; use it to understand the evidence behind each figure.

Also examine how much decisions change between versions. A refit can modify many parameters while barely changing actions, or alter a few coefficients near a threshold and change numerous entries. Distance between parameter files does not independently measure the economic impact of a handover.

If you define review alerts, separate them from automatic replacement rules. An alert can request investigation without deciding that a new model is better. This distinction acknowledges uncertainty and avoids presenting monitoring as a guarantee of profitable adaptation.

Metric aggregation deserves its own decision. Suppose two hypothetical classification blocks: the first gets nine of ten cases correct, and the second gets forty-five of ninety correct. Their accuracies are ninety and fifty percent. The simple average is seventy percent, but combined accuracy is fifty-four out of one hundred, or fifty-four percent. Both numbers express a weighting; only the latter gives each case equal weight.

Do not use this example to turn classification accuracy into trading profit. Its purpose is to show that averaging reports can change the question without making any arithmetic operation incorrect. If periods should have equal weight, explain why; if individual opportunities should be summarized, retain their denominators. For nonlinear metrics, an average of block values can have an even weaker relationship to the complete path’s metric.

This review also clarifies a period with zero trades. Its trading profit may be zero under the chosen convention, but a trade win rate has no denominator. Do not automatically replace an undefined quantity with zero and mix it with calculated rates. Preserve no-trade periods as their own state and explain which aggregates accommodate them and which require another treatment.

11. Rehearse the failed fit and the late model

An operational simulation should allow for a fit that does not produce a usable version. Information may be missing, validation may fail, or the permitted time may be exceeded. Decide what the strategy does: temporarily retain the previous version, abstain from new entries, or follow another previously specified policy.

The contingency plan also belongs to the evaluated procedure. Keeping the previous model during a failed update differs from always having the new one ready. If the backtest assumes instantaneous success at every cutoff, acknowledge that it evaluates an ideal rather than a complete reconstruction of the operating process.

Construct a rehearsal in which fitting begins at ten and finishes at five past ten, while a decision occurs at one past ten. Record which version was authorized then. Next introduce a version that fails a schema check. The system should reject it explicitly without mixing its transformations with the previous model.

Activating a version requires an identifiable transition. Retain its identity, applied checks, and effective time. If reverting to an earlier version is necessary, define which components are restored and how already open positions are treated. Recovering only a coefficient file may leave an inconsistent pipeline.

Arnott, Harvey, and Markowitz advocate protocol discipline for backtesting in the machine-learning era. This supports making study decisions explicit; our contingency rehearsals are original operational examples, not findings reported in their paper. Arnott, Harvey, and Markowitz, a backtesting protocol.

You do not need to simulate every imaginable failure from the beginning. Prioritize failures changing which information or version can govern a decision. A small set of well-specified cases usually provides more clarity than a vague promise of operational robustness without verifiable evidence.

Fitting, checking and activation are separate stages; a late version cannot govern earlier decisions.
The activation clock determines when a version can participate in the path.

12. The document that makes the walk-forward repeatable

A reproducible specification should generate the same windows and explain every boundary without consulting the result curve. Include the calendar rule, candidate window, label availability, feature context, fitted components, internal selection, and activation policy. Add how positions are preserved and results joined.

Review one complete transition by hand. After close sixty, identify rows one through fifty-seven with mature labels, the three pending rows, and the next block’s first decision. Mark which version produces that decision and what happens if fitting is late. This concrete traceability is worth more than an immaculate diagram whose implementation cannot be explained.

Walk-forward does not guarantee robustness or profitability. It organizes a question about temporal updating. It may reveal sensitivity to windows, deterioration, or insufficient information, and those conclusions are valuable too. A well-specified procedure can produce negative results without making the evaluation a methodological failure.

In TradeAndRoll, the initial scope is Forex and market CSV data belong exclusively to the demo. Studying rules and source code allows you to ask whether a robot needs learning, which parts can update, and which data an update would require. Do not assume every robot uses adaptive models or that an operational retraining service is included.

As a final exercise, write two recipes: one fixed and another refitting every twenty observations. Keep opportunities and targets equal, and use the same cost model and assumptions. Before running them, explain their differences in information, computation, and handover. If you cannot do this without seeing results, design decisions are still missing.

To check whether the record is sufficient, try reconstructing one decision from four pieces: the authorized information snapshot, the fitting recipe, the activated version, and the operating state it received. The first explains what could be learned; the second, how learning happened; the third, what actually became available; and the fourth, why a position was opened, maintained, or rejected. None replaces the others. Saving only the final model loses the conditions that made it applicable.

Then repeat this reconstruction at a boundary and on an ordinary date. If you can reproduce only fitting day, the state evolving between updates may be missing. If you can reproduce only intermediate dates, handover may depend on an unrecorded manual decision. Compare actions and their reasons, rather than cumulative profit alone. Two different sequences can accidentally agree on one final figure while representing different procedures.

This review has a practical limit too: it does not require every numerical execution to produce identical files in every environment. It requires defining accepted equivalences, relevant tolerances, and differences that change a decision. A small coefficient discrepancy can be irrelevant far from a threshold and decisive beside it. Verification therefore needs to reach the resulting actions under representative conditions, rather than stop at matching the names of saved models or reporting that fitting completed without an error.

A well-built calendar turns “adaptation” into a reviewable sequence: what was known, what was learned, when it became ready, and which actions changed. That sequence allows the procedure to be evaluated within its actual limits, instead of attributing intelligence to a collection of models that fits together only when the whole history is viewed from its end.

Three successive windows separate training, still-immature labels and later decisions.
The evaluated unit is an update procedure, rather than an isolated model.
Back to the Blog