Skip to content
Stock & Swing
Back to Trading Academy
Strategy

Backtest without using future information

3 min read

A backtest estimates how specified rules would have behaved on historical inputs under stated assumptions. Keep the simulation clock aligned with when each data item became available. A decision based on a closing value cannot normally assume execution at an earlier price in the same bar.

Build a reproducible test

Define the universe as it existed on each date when possible. Include failed or delisted securities to reduce survivorship bias. Apply consistent corporate-action data and model costs, unfilled orders, and slippage. Reserve later data for validation and log each parameter version.

Hypothetical example

A fictional test looks attractive when it makes decisions at the closing print and assumes every order fills at that same price. Moving fills to the next eligible observation and including a spread reduces the result substantially. The change shows how sensitive the simulation is to its execution model.

Practice

Write the exact timestamps used for observation and fill. Compare at least two cost assumptions and evaluate a holdout period once, after freezing your definitions. Keep losing periods in the report.

Write a decision clock

For each event, record the timestamp at which the trigger could be computed, the timestamp an order could be submitted, and the earliest possible execution time. Suppose a rule uses the 16:00 closing price and the close is confirmed seconds later. Assuming a purchase at the day's earlier low would use information from the future relative to the supposed execution. A more transparent test can compare an opening fill assumption with a later eligible quote and include scenarios for gaps, fees, and no fills.

Keep the universe and metrics honest

Preserve historical constituents, delisted instruments, and documented reasons for excluding data. Adjust for corporate actions consistently with the trading simulation. Review sample size, average gains and losses, dispersion, and the size and duration of losing stretches. A high win rate can still coexist with a negative average result. For example, eight hypothetical gains of $15 total $120, while two losses of $80 total $160. The sample then averages a $4 loss per event before costs. Test how that arithmetic changes under different trade sizes or correlated losses.

Check your interpretation

You try 50 rule variants and one performs well. Is that evidence the best variant will persist? Random variation and repeated selection can produce an apparently strong result. Reserve a genuinely unused validation period and freeze the chosen definitions before evaluating it. Record all tested variants, including poor results, and flag periods that the model may be poorly equipped to represent. A later paper simulation can expose time-of-day, order detail, and data delay assumptions that a historical chart alone would not detect.

Data-quality drill

Keep a table of data versions, universe changes, and exclusions. For each simulated event, show the assumed order type, quantity, decision time and fill rule. Review a random sample by hand and check the arithmetic before inspecting performance. If the software uses a bar's high and low to decide the order of events, test a conservative alternate ordering where the chart cannot resolve it.

Further reading

TradingView strategy simulation documentation

Stock & Swing Editorial

For education. Hypothetical examples illustrate concepts and do not represent trade recommendations.

Continue review your decisions

Lesson 2 of 3

Discuss this guide with the community