Skip to content
All library documents

Preparing MetaTrader Chart Objects for Composite Graphics

Article MQL5 articles

Summary

This installment prepares a library for building composite graphical objects on MetaTrader charts. Its design gives an extended base object a list of dependent objects and adds properties to record each object’s base ID and name. Dependent coordinates can be tied to one or more properties of the base object; for example, a coordinate may use the average of two anchor points. Because a dependent object may itself serve as a base, the intended structure supports nested groups.

The article updates the library’s type and property enumerations, sorting criteria, and classes for storing linked X and Y coordinate definitions. It then demonstrates creating extended objects and inspecting their properties and coordinate links. The implementation is preparatory: although the objects can be associated and their anchor coordinates represented, moving a trend line does not yet cause its attached price labels to follow. Real-time attachment and coordinated movement are described as future work, so this installment does not deliver a complete composite drawing tool or evaluate a trading strategy.

Key ideas

  • A composite chart object is designed around a base object with a list of dependent objects.
  • Dependent coordinates can be calculated from selected base-object properties, including multiple anchor points.
  • A dependent object may also act as the base for another group, enabling nested structures.
  • New IDs, names, and coordinate-link classes provide library support for extended objects.
  • The demonstration does not yet make dependent labels move with their base trend line.

Tags

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