Agentic Trading Index

Backtesting vs forward testing for autonomous agents

Trader reviewing performance metrics on a dashboard while comparing backtesting and forward testing
Photo by Rafael Minguet Delgado on Pexels

Friday evening. A developer looks at the dashboard after a bad week: the backtest is profitable, but the paper account is down, fills are late, and two orders remain in an uncertain state. The useful question is not which result to trust. It is which measurement changed, and why.

What each test actually measures

Backtesting applies a strategy to recorded market data and a model of execution. It is useful for checking whether a rule had a historical edge, comparing parameter choices and finding obvious failures. It cannot prove the agent will receive the data, construct the order or handle the response correctly in real time.

Forward testing runs the current strategy on data arriving in chronological order. It might send orders to a paper account, simulate orders locally, or trade small live size. Each method answers a different question. A local simulator tests strategy decisions against a chosen fill model. A broker paper account can test API calls and order-state handling, but may simulate fills and latency differently from the live venue. Small live orders expose real execution costs, while introducing financial risk.

Keep the strategy version, parameters, risk limits and market-data rules fixed during a test. Otherwise, a change in results could come from a changed strategy rather than a difference between historical and forward conditions. Record the data timestamp used for each decision, the decision timestamp, the order submission and every subsequent acknowledgement, fill, rejection or cancellation.

Historical testing has its own traps. A bar-based simulation may assume a fill at the close even though the decision could only be made after that close. Survivorship bias removes instruments that failed, and repeated parameter searches select noise as if it were signal.

Keep a genuinely untouched period for evaluation. If the strategy was repeatedly tuned against it, it is no longer untouched.

Choose metrics that expose the failure

Start with a shared set of outcome measures. Calculate returns after fees, spread and slippage, using the same instrument universe, sizing rules and time boundaries in both tests.

Track expectancy per trade as well as total return. Total return alone can hide differences in trade count, exposure or use.

  • Expectancy: mean net profit or loss per completed trade, reported in currency and in risk units such as R. Include open positions separately rather than silently treating them as closed.
  • Risk: maximum drawdown, realised volatility and tail losses. Also record the duration of drawdowns, since an agent may keep trading through a prolonged loss even when the final drawdown looks tolerable.
  • Execution: fill rate, rejection rate, cancel-to-fill ratio, partial-fill frequency and slippage against a defined reference price. For market orders, the decision-time mid-price is often a useful reference.
  • Operations: decision-to-submit time, submit-to-acknowledgement time, stale-data events, retries and unresolved order states. These are strategy risks when the software trades without supervision.

Report denominators. A rejection rate of 2 per cent means little without the number of submitted orders and the reason codes. A single duplicate order can matter more than dozens of harmless rejects. Track both event counts and their financial impact.

Uncertainty matters as much as the point estimate. A strategy with 80 trades and positive average returns can still have a wide range of plausible outcomes. Use confidence intervals, and consider block resampling when trades cluster by day or market regime. Do not treat each trade as independent if many positions respond to the same price move. Sharpe ratios also need caution: serially correlated returns can make the apparent risk-adjusted result look better than it is.

Measure the execution gap

Build a paired comparison for each signal: what the backtest expected, what the forward system decided, and what happened to the order. Separate price movement after the signal from execution shortfall. If the market moved before submission, the cause may be data or compute latency. If the order reached the venue promptly but filled poorly, investigate spread, liquidity, order type and size.

The figures below are typical market ranges for small orders in ordinary conditions, not universal limits or audited platform results. Instrument, venue, order size and volatility can move them sharply. They are starting points for test design, not values to copy into a fill model.

MarketTypical quoted spreadTypical market-order slippageTypical API acknowledgement latency
Liquid US equities1-5 basis points1-10 basis points50-500 milliseconds
Major FX pairs0.1-1.0 pips0.1-1.5 pips50-300 milliseconds
Liquid crypto spot1-10 basis points1-20 basis points50-1,000 milliseconds

Compare slippage in basis points or pips, not only currency, and segment it by order size, time of day and volatility. For a limit order, track the fill probability and the price movement after a fill. A backtest that assumes every touched limit order fills can overstate performance, especially when the price only briefly trades at the limit.

Use the order event log to distinguish a slow acknowledgement from a lost response. A timeout does not mean the broker rejected the order. Retrying without checking order status can create duplicates.

Count an order as unresolved until the system has reconciled its client order ID, broker order ID and latest known state. A paper environment such as FX-Tech's agentic trading tools can help exercise order workflows before capital is at risk, but its fill behaviour still needs comparison with the target venue.

Run a forward test that can disprove the backtest

Set the test up to answer a specific question, such as whether expected costs survive at the intended order size, or whether reconnect logic restores a consistent position after an API interruption. Define acceptance limits before seeing the results. If limits move after a loss, the test becomes a search for a favourable interpretation.

  1. Freeze the candidate. Save the code version, parameters, data sources and risk configuration. Hash or otherwise identify the deployed build.
  2. Choose a test mode. Use historical replay for repeatable strategy checks, broker paper trading for API and order-state behaviour, or small live size for real fills. State what the chosen mode cannot measure.
  3. Set a measurement window and stop conditions. Include enough market sessions to encounter relevant conditions, but do not claim that a fixed number of days proves robustness. Stop on predefined faults such as duplicate orders, position mismatch, stale data beyond the limit or a breached risk cap.
  4. Log the full path. Store market-data timestamps, features, decisions, request payloads, acknowledgements, fills, fees, cancellations and reconciliation results. Keep clock synchronisation and time zones consistent.
  5. Compare matched trades. Align signals by instrument and time. Attribute return differences to signal timing, sizing, missed fills, price slippage, fees or operational faults rather than labelling every gap as market noise.
  6. Decide before retuning. Apply the stated acceptance rules. If the agent fails, diagnose and change one cause at a time, then test the revised version on fresh forward data.

A useful review has two views. The first is strategy performance after realistic costs.

The second is system reliability: order-state reconciliation, risk-limit enforcement and recovery from partial failure. A profitable test with inconsistent positions is not a successful unattended strategy. Conversely, a return shortfall caused by a conservative paper fill model may call for better execution modelling, not a new signal.

The mistake most readers will still make is comparing a clean backtest return with a forward account return, then changing the strategy before tracing the orders and costs that produced the gap.

Frequently Asked Questions

How long should a forward test run?

Run it long enough to observe the strategy's relevant market conditions and operational events, not just to reach a calendar target. Define the window and stop conditions in advance, and treat a short sample as uncertain rather than conclusive.

Is paper trading enough to validate an automated strategy?

Paper trading can test data handling, API calls, order-state logic and some simulated execution. It may not reproduce live queue position, slippage, liquidity or latency, so it cannot by itself establish live profitability.

Which metrics should match between a backtest and forward test?

Compare net expectancy, trade count, exposure, drawdown and volatility using the same periods and sizing rules. Also compare fill rate, slippage, fees, rejections and order-state errors to identify where execution diverges.