MetaTrader Graphical Object Events for Programmatic Chart Handling
Summary
This installment describes adding event handling for graphical objects in a MetaTrader library. Its aim is to let an expert advisor respond to object changes through chart events instead of repeatedly polling object properties, which the article characterizes as resource intensive. The event categories include object creation, property changes, renaming, deletion, and deletion along with a chart. Renaming is treated separately because the platform may represent it as a sequence of removal, creation, and property-change events.
The implementation extends event forwarding to include object clicks on other charts, adds event identifiers and messages, and routes chart events to a collection that manages graphical objects. The article gives code-level instructions and describes a manual demonstration in which clicking charts creates vertical lines and subsequent property changes appear in the journal. It notes that programmatically created objects do not generate a creation notification because the program already knows about them. This is a library and platform integration tutorial, not evidence about trading performance; handling the precise changed properties is deferred to a later installment.
Key ideas
- Chart event handling can notify a program when graphical objects change without constant property polling.
- The library defines events for object creation, property changes, renaming, deletion, and chart closure.
- Renaming is separated from ordinary property changes because it can produce several underlying events.
- An event-control indicator forwards object clicks and related events from other charts.
- The demonstration verifies journal messages, while detailed property-level handling is left for later work.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.