Caching Market Time Series to Speed Up Repeated MQL5 Lookups
Summary
This article describes a MQL5 library that caches a symbol’s rate data so repeated time-series queries can reuse an initialized array. Its examples focus on bar shifts and related series operations, such as retrieving open, high, low, close, volume, and time values. The proposed approach avoids repeatedly allocating, resizing, copying, and freeing arrays for each lookup. It supports automatic refresh when a new bar forms, or manual refresh when the caller disables automatic updates for faster access during critical processing.
The article reports that initialization takes longer, while later calls can be substantially faster; it also gives benchmark claims for repeated calls and compares them with another bar-shift implementation. Those figures are the author’s reported results, not independently established evidence here. The caching approach is most relevant when many lookups use the same symbol and timeframe. For occasional queries, initialization and refresh management may outweigh the speed benefit, and disabling automatic refresh requires the program to refresh data deliberately.
Key ideas
- Caching a copied rates array can reduce repeated memory allocation during time-series lookups.
- The library offers both automatic refresh and manually managed refresh modes.
- Its author says the performance gain is most useful for many repeated queries on the same symbol and timeframe.
- Initialization has an upfront cost that may outweigh the benefit for infrequent lookups.
- The reported benchmark gains are claims in the article and are not independently verified there.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.