EngineBacktesting

Backtesting

Replay historical data, understand simulated execution, and compare strategy behavior reproducibly.

A backtest runs strategy code against historical observations using simulated execution. Use it to explain how inputs become signals, requests, and outcomes, and to compare revisions under recorded assumptions.

These guides follow the standalone SJS crossover. Start with its deterministic signal and one instrument, then vary one setting at a time.

Choose your workflow

WorkflowWhat it provides
App-editor historical testA quick check of the app's source and selected data, with chart, trades, and log access
Agent Lab historical runA run attached to a source revision, saved result artifacts, and reusable experiment data
Running simulated sessionOngoing incoming data with simulated execution; different from replaying a fixed historical window

Agent Lab currently uses the generic memory runtime for supported bar-based experiments. It does not reproduce every broker-specific app runtime. Other app-editor workflows, such as Polymarket simulation, have their own execution behavior.

Follow the decision to its outcome

Source revision + data selection + execution settings

                 Historical observations

              Warmup and strategy decisions

               Requests and simulated fills

                Results, logs, and comparison

An observation can produce no decision; a decision can produce no request; an accepted request can remain pending. Keep those stages separate when investigating a result.

Read in order

  1. Getting started: run the SJS example and establish a baseline.
  2. Market data: inspect selection, coverage, and the frames your script receives.
  3. Execution and fills: understand price checks, delay, and run-end closing.
  4. Warmup: supply enough history without assuming live warmup behavior.
  5. Reading results: interpret trade records, logs, and metrics.
  6. Comparing runs: distinguish source changes from data and execution changes.
  7. Debugging: locate the first unexpected stage.
  8. Limitations: understand what the simulation does and does not model.

On this page