Wrapping the MQL5 ZigZag Indicator in an Object-Oriented Library
Summary
This article explains how to integrate MetaTrader 5’s ZigZag indicator into the MQL5 Standard Library style. It contrasts a procedural Expert Advisor that creates an indicator handle and copies buffers with an object-oriented example that creates a CiZigZag instance, refreshes it, and reads its values through methods. The goal is to make indicator access consistent with other library indicators and easier to reuse in larger applications.
The implementation approach is to study the library’s existing indicator classes, then create a custom class following their conventions and derive it from the library’s indicator framework. The article shows example usage and reports simple checks in which the wrapper returns ZigZag values. It argues that this organization can support maintainability and reuse as applications grow. The evidence is illustrative rather than a trading evaluation: it does not test a strategy’s profitability, and the excerpt omits much of the wrapper implementation. ZigZag values can also change as new price data arrives, so the example is not evidence of predictive performance.
Key ideas
- A custom indicator wrapper can make ZigZag access consistent with MQL5 Standard Library classes.
- The procedural example reads indicator buffers, while the object-oriented example uses methods to access values.
- The article recommends following existing library class conventions when extending the framework.
- The reported checks demonstrate wrapper operation, not trading performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.