Skip to content
All library documents

Improving a MetaTrader Charting Library with Active-Chart Checks and Reusable Classes

Article MQL5 articles

Summary

This article describes improvements to a MetaTrader charting and keyboard-shortcut library. To reduce unnecessary work when many charts are open, the indicator checks keyboard events only on the chart in the foreground. The author reports that users found the application more responsive, though no measured speed gain is provided. Drawing remains resource-intensive when charts contain many objects, and searching for price extrema is identified as the library’s most demanding calculation.

The article also refactors utilities and drawing features to reduce dependencies on global settings and mouse-handling code. Classes expose settings through access methods, allowing values to change at runtime and making utility components easier to reuse in other projects. A crosshair feature draws horizontal and vertical lines at cursor coordinates or supplied price and time coordinates, and a shortcut table describes other chart tools. The material is primarily a software design and charting workflow guide; it offers qualitative performance feedback rather than controlled benchmarks or trading results.

Key ideas

  • Processing keyboard shortcuts only on the foreground chart can reduce redundant work across open charts.
  • The reported responsiveness improvement is based on user feedback, without quantified benchmark results.
  • Graphics and price-extrema searches are the main identified sources of processing cost.
  • Encapsulating settings behind class access methods reduces dependencies and supports runtime changes.
  • A crosshair tool can use either cursor coordinates or explicitly supplied time and price values.

Tags

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