Skip to content
All library documents

Measuring Net Strategy Tester and OnTick Performance in MetaTrader 5

Article MQL5 code base

Summary

The document explains how to measure Expert Advisor runtime in MetaTrader 5 while excluding delays that can distort the tester’s reported duration. It distinguishes total run time, which can include history synchronization and tick preprocessing, from net tester time, measured from the first OnTick event through the final tick. A supplied library records this interval and reports processed event counts and throughput.

For repeated measurements, the document describes using optimization mode to run the EA multiple times and report minimum, maximum, and mean durations, along with the share of total optimizer time spent in tester operation. An optional OnTick profiler isolates time spent executing the EA’s OnTick handler. Example logs illustrate both methods, and a sample EA is presented as a way to compare trade API implementations. The measurements support runtime comparisons and bottleneck investigation; the document cautions that profiling OnTick adds some overhead, and its examples do not establish performance for other systems or workloads.

Key ideas

  • Net tester time measures the interval from the first OnTick through the final tested tick.
  • Synchronization and preprocessing can make total run duration a poor measure of EA performance.
  • Repeated optimization runs provide minimum, maximum, and mean timing statistics.
  • An optional profiler measures time spent inside OnTick and may slightly slow execution.
  • The example demonstrates comparing alternative trade API implementations.

Tags

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