Building a Database-Backed Trading Server Simulator for Market Replay
Summary
This installment describes extending a market replay system so it can model essential trading-server behavior, including positions and pending orders. The design uses a database to store and search trading records, with a deliberately simple single-table structure and limited data validation. The Expert Advisor and order-handling class are adapted to use the simulation path during replay, while chart indicators display and manage simulated orders and positions. Trade transaction events remain part of the flow.
The article explains integration points and design choices, such as where to check whether replay is paused and why the existing order class is adapted rather than duplicated. It positions the simulator as a foundation for testing an Expert Advisor against replayed market data, with later work expected to fill in additional server behavior. This is implementation guidance rather than a measured validation study: the simulated system covers only essential elements and does not claim full equivalence to a live broker or report strategy performance.
Key ideas
- A database provides shared storage for records used by applications in the market replay system.
- The example models essential server behavior for positions and pending orders during replay.
- The existing order-handling class is adapted to simulation instead of creating a parallel class.
- The Expert Advisor and chart indicators coordinate order handling and position display in the simulation.
- The author describes the system as a partial model that requires additional behavior for broader realism.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.