Skip to content
All library documents

MQL5 Spectrum Analyzer Interface and Chart Object Coordinates

Article MQL5 articles

Summary

This article presents a prototype spectrum analyzer indicator as an example of building a graphical interface with MQL5 chart objects. It explains two coordinate systems: pixel offsets anchored to a chart window for controls such as labels and buttons, and time-and-price coordinates tied to the chart for objects such as lines and rectangles. By fixing chart display settings, the indicator aligns both kinds of objects around a shared anchor point.

The article also describes saving chart properties when the indicator loads and restoring them when it is removed, so temporary display changes do not persist. Its interface includes a scrollable output area whose displayed rows can be changed with buttons or an entry field. The analyzer is explicitly a prototype, and the article does not provide a complete algorithm or performance evaluation. It suggests that a finished version would need a stronger spectrum-estimation method and a more developed interface.

Key ideas

  • MQL5 chart objects can be positioned relative to the window in pixels or relative to chart time and price.
  • Fixed chart settings can keep chart-anchored objects aligned with window-anchored controls.
  • A custom chart class can store display properties and restore them when the indicator is removed.
  • The prototype uses chart events to update which section of its output list is displayed.
  • The article focuses on graphical-object techniques and leaves spectrum estimation improvements to future work.

Tags

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