Discussing the article: "Creating Custom Indicators in MQL5 (Part 3): Multi-Gauge Enhancements with Sector and Round Styles"

 

Check out the new article: Creating Custom Indicators in MQL5 (Part 3): Multi-Gauge Enhancements with Sector and Round Styles.

In this article, we enhance the gauge-based indicator in MQL5 to support multiple oscillators, allowing user selection through an enumeration for single or combined displays. We introduce sector and round gauge styles via derived classes from a base gauge framework, improving case rendering with arcs, lines, and polygons for a more refined visual appearance.

The multi-gauge framework builds on a base class for customizable gauges, introducing derived classes for round and sector styles to visualize oscillators like the Relative Strength Index, the Commodity Channel Index, and the Money Flow Index, where we select single or combined displays via an enumeration for flexible momentum analysis across indicators. The round style maintains circular casing with filled circles, while the sector style enhances visuals with arc-based sectors, rounding arcs, connecting lines, and polygons for partial dial shapes, adapting to angle ranges and supporting relative positioning to align multiple gauges horizontally on the chart. This idea sprouted from the fact that at some instance, you might require just a small section of a gauge to display some information, and thus we thought it was a great idea to sub-divide the full round gauge into a half and a quarter, so you can choose whichever fits your style, but in our case, we are going to do the 3, conditionally.

To achieve that, we plan to extend the base gauge class with pure virtual methods for case calculation and drawing, allowing overrides in derived classes for style-specific logic. We will add an enumeration for gauge selection to conditionally initialize and position instances for the Relative Strength Index (round), the Commodity Channel Index (sector), and the Money Flow Index (sector), integrating their handles and buffers for data copying. We need these to get visual data, but in your case, you can use anything else, like displaying profits, indicator flow, and progress, or even account metrics, not limited to some other indicator data. The architecture separates layers for scale (with enhanced mark population for zero positions) and needle (with adjustable tail multipliers), ensuring efficient redraws and relative anchoring based on previous gauges. In brief, here is a visual representation of our objectives.

GAUGE ARCHITECTURE OVERVIEW

Author: Allan Munene Mutiiria