Discussing the article: "Building a Hierarchical Market Structure Framework (Prototype) in MQL5 Using Modular Architecture and Event-Driven Design"

 

Check out the new article: Building a Hierarchical Market Structure Framework (Prototype) in MQL5 Using Modular Architecture and Event-Driven Design.

This article describes a prototype reusable market structure framework for MQL5, built with a clean modular architecture and an internal event queue. It shows how to detect swing points, classify break-of-structure and change-of-character events, maintain a deterministic market state, and persist data to CSV. The focus is entirely on software engineering, component separation, and extensibility, not on trading signals. The prototype is a foundation for further development, not a production-ready library.

Market structure analysis underpins many discretionary and algorithmic approaches. A trader or developer needs not only to see swing highs and lows, trends, breaks of structure, and changes of character on a chart, but also to obtain that same data in a programmatically accessible form, for an Expert Advisor, a research tool, or adashboard.

Most existing market structure indicators for MQL5 are closed, monolithic solutions. They draw lines and labels but expose no convenient interface through which another module can query the current structure state, recent events, or active protected levels. The developer must therefore either extract and embed fragments of the indicator logic into an EA, or rewrite the entire algorithm from scratch. Both paths lead to code duplication, tight coupling, and rising maintenance costs.

This article presents a prototype modular framework for market structure analysis, written entirely in MQL5. It is not a trading strategy or a tutorial on Smart Money Concepts; it is an exercise in applied software architecture. The framework identifies swing points, classifies internal and external structure, emits events when a structural break or change of character occurs, maintains a market state machine, persists every activity to disk, and exposes a unified public API. 

The solution is organized into a set of include files and attaches to a chart as a standard custom indicator. Its output can be consumed by EAs, dashboards, machine learning pipelines, and any other system that requires structured market intelligence.

Author: Stanley Kimathi Kibaara