A profitable backtest does not prove an agent can trade profitably. It shows that a set of rules would have made money under a model of past data and execution. Forward testing checks whether those rules, orders and recovery logic behave under current market and API conditions.
Both tests are necessary, but they answer different questions. A historical simulation can test thousands of market conditions quickly.
A forward test exposes live data delays, order rejections, partial fills and other details a bar-based model often misses. The practical goal is not to make the two results match exactly. It is to find out why they differ before live capital is exposed.
Separate strategy evidence from execution evidence
Backtesting estimates whether a signal has an edge. Forward testing checks whether the software can capture that edge. Keep the results separate: a profitable signal can have poor execution, and reliable order handling cannot rescue a strategy with negative expectancy after costs.
Use point-in-time data. A historical universe should not contain only securities that survived to the end of the test.
Apply corporate actions as they were known, preserve delisted instruments where relevant, and ensure every feature uses information available at the decision timestamp. If a signal uses a bar close, the order cannot fill at that same close unless the execution model supports it and the timing is defensible.
Freeze the strategy version and configuration before each test. Record the code commit, data snapshot, parameters, instrument list and start and end times. Otherwise a forward test can turn into a moving target: a developer adjusts the threshold after a bad session, then treats the revised results as confirmation.
A backtest tests a market model. A forward test tests the whole trading system.
Build a backtest that charges for the real order path
Start with the order types the agent will actually send. A market order needs a spread and slippage model. A passive limit order needs a queue and fill model. A stop order needs rules for gaps and triggering prices. A simulation that fills every limit order whenever the market touches its price is usually too generous.
Model fees on the correct side of the trade, plus exchange charges, funding or borrow costs where applicable. For a strategy that turns over frequently, even a few basis points per fill can erase a small signal.
Run sensitivity tests at the expected cost and at 1.5 and 2 times that cost. If performance collapses under a modest increase, treat the edge as fragile.
Include operational behaviour in the replay, not just price calculations. The agent should process acknowledgement, fill, partial fill, cancel and reject events in order.
Test duplicate events, delayed responses and restart recovery. An order submitted twice after a timeout can turn a small intended position into an unintended one.
- Use bid and ask prices or a documented spread estimate, not only candle closes.
- Apply realistic order delay between signal calculation and venue submission.
- Track open orders and positions separately, then reconcile them after simulated restarts.
- Keep training, validation and final holdout periods distinct. Do not tune parameters on the holdout.
For each run, save trade-level inputs and outputs: signal time, decision time, order parameters, assumed fill, fees and exit reason. That makes a bad result diagnosable instead of merely disappointing.
Run forward tests in controlled stages
Forward testing should begin with a read-only check, then move to simulated orders and finally to small live orders if the venue and controls allow it. A paper environment can confirm that the agent builds valid requests and follows order state changes, but it cannot establish live queue priority or guarantee real fills. A service such as agentic paper trading can provide a repeatable simulated stage before live exposure.
Use a fixed observation window and an explicit pass condition. For an intraday strategy, 20 to 40 trading sessions and at least 100 completed orders can reveal common integration faults.
That sample is not proof of a durable edge. For a low-frequency strategy, collect enough events to test its order lifecycle and risk controls, then keep statistical claims appropriately limited.
Use this sequence for each strategy version:
- Run the agent in shadow mode for 5 to 10 sessions. Generate decisions from live data, but do not send orders. Compare timestamps, features and intended orders with recorded inputs.
- Enable paper orders for at least 20 sessions or 100 order events. Check acknowledgements, fills, cancels, rejects and position reconciliation.
- Review the differences from the backtest. Attribute them to spread, fees, latency, missed fills, data timing or a change in market regime.
- If controls pass, consider a limited live pilot with a pre-set position cap and daily loss limit. Do not increase size while investigating unexplained discrepancies.
Reset the test if code or parameters change materially. A bug fix to logging may not affect the signal; a change to order timing does. Record the change and run the relevant stages again rather than combining results from unlike versions.
Compare the numbers without treating them as guarantees
The table gives typical market ranges for planning and diagnostics, not targets or audited outcomes. Actual values vary by venue, instrument, order size, API route and market conditions. A liquid equity order and a thin crypto market order should not share one slippage assumption.
| Measure, typical ranges | Backtest assumption to test | Forward-test observation to expect | What a gap can indicate |
|---|---|---|---|
| Market-order slippage in liquid instruments | 1 to 5 basis points in normal conditions | 2 to 10 basis points normally, with 10 to 50 in stressed or thin conditions | Spread, size or latency is under-modelled |
| Passive limit fill at the touch | 50% to 100% if the model fills on a price touch | About 10% to 60% within 1 to 5 seconds, depending on queue and venue | The simulation assumes queue priority it does not have |
| Order acknowledgement latency | Often set to zero in a simple simulation | Roughly 50 to 300 ms at the median, with p99 around 0.5 to 3 seconds for many API routes | Timeouts or stale decisions may affect execution |
| Partial fills | Often omitted or treated as all-or-none | Can affect 5% to 30% of orders, depending on order type and liquidity | Position sizing or cancel-and-replace logic needs review |
| Valid order rejection rate | Usually assumed to be zero | Often near zero for well-formed requests, but bursts can occur around limits or venue conditions | Request validation, rate limits or account state may be wrong |
Compare net expectancy after fees, not just gross returns. Track slippage per filled order, fill rate, reject rate, p50 and p99 acknowledgement latency, maximum drawdown, turnover and exposure. Keep both counts and rates: one rejected order out of ten is different from one out of a thousand.
Set stop conditions before enabling unattended orders
Write thresholds before the forward test starts. For example, investigate if realised costs exceed the backtest estimate by more than 50% over 30 or more fills, if valid-order rejections exceed 1%, or if the agent cannot reconcile its position after a restart. These are starting thresholds, not universal standards. Set tighter limits where order size, use or strategy speed leaves little room for error.
Make the response automatic. A cost breach can block new entries while allowing exits.
A stale market-data feed can cancel resting orders and pause the strategy. A mismatch between the agent's position and the venue's position should stop trading until reconciliation completes. Log each trigger with the state that caused it, so an operator can tell whether the system paused for a real risk or a faulty monitor.
Do not treat a profitable paper result as permission to scale. Paper fills are simulated, and small orders may behave differently from larger ones.
Where live testing is permitted, begin below the intended production size, set a hard maximum position and daily loss limit, and review every order event. The test passes only when the signal and the order-handling system meet their separate criteria.
Before the next deployment, check your measured p99 acknowledgement latency against a 1,000 ms timeout. If the timeout is fixed at 1,000 ms, confirm that the p99 stays below 750 ms.
Frequently Asked Questions
How long should I forward test a trading strategy?
For an intraday strategy, 20 to 40 trading sessions and at least 100 completed order events can expose common execution and integration faults. That sample does not prove a durable edge, especially if trades are clustered in one market regime. Use longer windows for lower-frequency strategies.
Can paper trading replace a backtest?
No. Paper trading tests current data handling and simulated order workflows, while a backtest evaluates a strategy across a broader historical sample. Paper environments also cannot guarantee real queue position or live fills.
What should I compare between backtesting and forward testing?
Compare net expectancy after costs, slippage per fill, fill rate, rejected orders, latency and position reconciliation. Save order-level records so differences can be traced to a specific assumption or system event.
When should an agent move from paper trading to live orders?
Move only after the agent passes pre-set checks for request validity, order state handling, recovery and risk limits. If live trading is permitted, begin with a small position cap and a daily loss limit. A profitable paper result alone is not a pass condition.