Skip to content
All library documents

Setting Minimum Tick Counts for Market Replay Simulation

Article MQL5 articles

Summary

This installment of a market replay system series addresses how many simulated ticks are needed to represent a one-minute bar’s open, high, low, and close. It derives minimum counts from the OHLC configuration: one tick when all prices coincide, two when open and close occupy opposite extremes, three when one endpoint is an extreme and the other is not, and four for the remaining distinct-price cases. The implementation also caps or adjusts the tick count using a configurable maximum and available tick-volume data.

The article then discusses handling invalid or undersized configuration values and stresses checking the simulation function’s return before using its output. The code fragment is presented as a correction to an earlier version, rather than a complete system description. It notes that random-walk-generated ticks differ visibly from real trade ticks, and that some chart objects may not be removed correctly and the service can pause unexpectedly. The material is useful for replay-system engineering, but it provides no quantitative evidence that the simulated tick paths reproduce market microstructure faithfully.

Key ideas

  • The minimum simulated tick count depends on how the bar’s OHLC prices relate to one another.
  • A configurable tick maximum can accommodate differences in workstation capacity.
  • Tick-volume and configuration limits must not reduce generated ticks below the OHLC minimum.
  • Callers should validate the simulation function’s return before using its tick array.
  • Random-walk ticks are a timing and plotting approximation and can differ from actual trade data.

Tags

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