Designing an Abstract Indicator Buffer Class for MQL5
Summary
This article describes an object-oriented foundation for managing indicator buffers in the DoEasy MQL5 library. Rather than defining separate data structures for each drawing style, it proposes a shared abstract buffer class for properties common to all buffers, with specialized descendant classes to specify individual plot types. The base object tracks buffer type and status, symbol and timeframe, display settings, array indices, color-buffer information, and related plotting properties. The design aims to let a program request a buffer type and have the library manage array allocation and binding.
The article walks through adding descriptive messages for buffer properties and checking that created arrays are assigned as indicator buffers and appear in the terminal’s indicator settings. It treats colored buffers as the common implementation, with one color usable for a monochrome plot. The demonstrated work is an intermediate software component, not a trading signal or performance study; support for the range of drawing styles depends on descendant classes planned for later installments. The attached implementation is intended for MetaTrader 5 and is not reported as tested in MetaTrader 4.
Key ideas
- A shared abstract buffer class can hold properties common to different indicator drawing styles.
- Specialized descendant classes can define behavior and settings for individual plot types.
- The proposed object records both display properties and auxiliary array-index information needed to manage buffers.
- The library design aims to automate buffer creation and binding instead of requiring manual array setup for every plot.
- The article demonstrates basic terminal checks and describes an MQL5 implementation whose specialized classes are future work.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.