Skip to content
All library documents

Updating Multi-Symbol Timeseries Only When New Ticks Arrive

Article MQL5 articles

Summary

This installment extends a MetaTrader 5 library that stores historical timeseries for multiple symbols and periods. Its central problem is keeping non-chart symbols current without repeatedly refreshing every series on a timer, which wastes work when no prices have changed. The proposed approach tracks each symbol’s prior and current tick times and treats a changed timestamp as a new-tick event. That event triggers updates to the associated timeseries, including the current bar.

The article introduces a new tick object and adjusts supporting classes, chart identifiers, and bar descriptions to support this flow. It describes testing with several symbols on one timeframe and reports that the displayed current-bar values from two retrieval paths match and update as ticks arrive. These checks illustrate functional consistency in the described setup, not broad performance or trading results. The method also depends on receiving usable tick data for each tracked symbol, and the article notes that further library work is needed for indicator use.

Key ideas

  • Compare a tracked symbol’s previous and current tick times to detect updates outside the chart’s own symbol.
  • Refresh a timeseries when a new tick arrives instead of updating all symbols on every timer event.
  • A dedicated tick object stores symbol and tick state for the update process.
  • The described test checks that two current-bar data paths agree across several symbols.
  • The article focuses on library mechanics and does not assess a trading strategy.

Tags

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