Skip to content
All library documents

NautilusTrader Backtest APIs, Data Streaming, and Repeated Runs

Article MQL5 code base

Summary

This guide explains how to choose between NautilusTrader’s low-level BacktestEngine and high-level BacktestNode APIs. The engine offers direct control over venues, instruments, strategies, and data, including manual streaming when a dataset is too large for memory. Data streams are ordered and merged for replay; after adding unsorted batches, the engine must be made ready before running. Streaming runs pause at batch boundaries, and a final end call flushes timers and stop handlers.

The node API is designed for catalog-backed runs, with configuration for venues, data, fees, time bounds, and chunking. The guide also explains error-triggered shutdown, engine reset behavior, and how to structure independent configurations versus parameter runs that reuse loaded data. It gives API examples and behavioral details, rather than trading results. These are operational instructions for managing backtests; they do not establish the validity of any strategy or address the quality of the underlying data.

Key ideas

  • Use BacktestEngine for direct component control and manual data handling, and BacktestNode for configurable catalog-backed runs.
  • Engine data inputs are copied, ordered by replay time, and merged across streams.
  • Manual streaming requires adding batches, running in streaming mode, clearing data, and ending after the last batch.
  • Engine reset retains registered data and components while clearing trading and runtime state.
  • Create and dispose a fresh BacktestNode for each independent configuration.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.