EngineBacktesting

Reading backtest results

Trace signals, execution records, logs, and summary metrics without confusing them with each other.

Start by explaining one entry and one exit. Summary metrics become useful after you can connect a signal's evidence to its request and resulting execution record.

Follow one decision

For the SJS crossover, compare the market timestamp, close, calculated average, and signal side. Its sjs-crossover log records attempted submissions with an accepted or not-accepted outcome. A caught exception uses sjs-crossover-error.

Then inspect the resulting order, position, and trade information exposed by your workflow. The tutorial's local lastAttempt is a diagnostic record, not a broker receipt or a replacement for execution state.

Trade records are not always round trips

The generic memory simulator records entry fills as well as reducing/closing fills. A same-side add can also produce a record. Consequently, a displayed count of trade records is not automatically the number of completed entry-to-exit round trips.

Entry records commonly have identical entry and fill prices, while closing records carry the original position's entry price and the closing quote price. The engine derives pnl from its instrument-aware trade calculation. Inspect quantity, action, entry date, and execution date when relating rows to a position lifecycle.

The last row may come from a run-end close attempt rather than an EXIT signal in your source. Read Execution and fills before attributing every closing record to strategy logic.

Agent Lab's current summary metrics

MetricCurrent calculation
Trade countNumber of returned trade records
Net P&LSum of numeric pnl values, treating missing/unusable values as zero
Winning tradesNumber of records with numeric pnl greater than zero

These are summaries of the worker's returned records. The label “Net P&L” does not by itself establish that a realistic commission, slippage, spread, and financing model was applied. Check the execution path and costs represented in the records.

If you calculate a winning percentage from these counters, remember that entry records can affect the denominator. Do not present it as a round-trip win rate without reconstructing and validating that grouping.

Logs and saved artifacts

The app-editor quick-test path stores full logs separately when log storage succeeds and exposes metadata for retrieving them. Their availability can expire; they are not guaranteed permanent experiment history.

Agent Lab stores completed-run logs separately from the result artifact. The Logs view loads them in pages and supports time-range and text filters; the assistant can inspect the same saved logs with its run-log search tool. Log files expire according to the configured retention period, so expired or unavailable logs are not proof that an event did not happen.

Do not expect arbitrary sjsState, complete pending-order snapshots, or every custom trade metadata field to appear in a Lab result. Log compact evidence you need and choose a short enough run to inspect it. The full session APIs described in the SJS guides apply during execution; a saved artifact is a different representation.

Completion is a workflow state

A completed run means the historical job finished successfully. It does not establish that every signal traded, every accepted request filled, or the final simulated position was closed. A failed or cancelled run also should not be compared as if it were a completed baseline.

Continue with Comparing runs and Debugging.

On this page