Skip to content
All library documents

Event Monitoring for Reusable MQL5 Library Objects

Article MQL5 articles

Summary

The article describes extending a shared base class so MQL5 library objects can monitor changes to their integer and real properties. A timer-driven refresh compares current and prior values, detects increases, decreases, and crossings of configured levels, and passes resulting events from object collections to the main program. Properties that do not need monitoring are excluded with a sentinel value, avoiding separate event flags for every class.

Each event combines a property identifier, reason, and collection class identifier; the article explains packing several small integers into one event parameter and using the object name to identify the source. A symbol-object example demonstrates monitoring spread and price levels, with journal output for observed changes. The method is reusable across object types, but the excerpt is primarily a library implementation tutorial, not a trading strategy or performance study. Its examples show event delivery and configuration, without measuring reliability, latency, or trading outcomes.

Key ideas

  • A shared base class can detect property changes across many library object types.
  • A refresh cycle compares current values with prior values and configured control levels.
  • Event records encode the changed property, its direction or threshold condition, and its collection class.
  • Unmonitored properties can be skipped, reducing the need for class-specific event flags.
  • The article demonstrates event logging but provides no performance evaluation.

Tags

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