Skip to content
All library documents

Caching Symbol Specifications and Trading Sessions in Multi-Symbol EAs

Article MQL5 articles

Summary

This article describes an MQL5 cache for symbol contract metadata and weekly trading sessions. A cache class loads stable properties such as point size, lot limits, contract size, currencies, and trade mode during initialization, then serves reads from memory. It also stores session windows so the EA can determine whether a market is open through local time comparisons rather than repeated terminal queries.

The article estimates lookup overhead for different symbol counts and tick rates, then describes a benchmark and correctness checks intended to measure the effect on the reader's own instrument universe. It draws an important boundary between stable metadata and live market values such as bid, ask, spread, and volume, which must not be cached. Tick value can also shift for cross-currency instruments as exchange rates change. Refreshing is manual, with a daily timer suggested; the cache cannot detect a broker specification change between refreshes, and claimed speed gains depend on workload and measurement conditions.

Key ideas

  • Cache stable contract properties and session schedules to reduce repeated terminal lookups.
  • Live prices, spreads, and volumes change with market data and should remain uncached.
  • Tick value may change for instruments whose profit currency differs from the account currency.
  • A manual refresh strategy limits terminal access but may leave changes unnoticed until the next refresh.
  • Benchmarks should compare cache reads with live values using tolerances suited to each field.

Tags

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