Discussing the article: "Automating Chart Patterns in MQL5 (Part 1): The Multi-Timeframe Swing Structure Engine"

 

Check out the new article: Automating Chart Patterns in MQL5 (Part 1): The Multi-Timeframe Swing Structure Engine.

This article presents CSwingEngine, a reusable MQL5 class that detects H4 swing highs and lows, labels them HH, LH, HL, or LL, and classifies market structure as trend or range. Swings are always computed on H4, regardless of the attached chart, and each point draws correctly on lower timeframes via native datetime anchoring. The engine exposes a clean interface to query the current trend and retrieve the swing array for context-aware pattern logic.

This article lays the foundation: CSwingEngine, a self-contained, reusable class that any EA or indicator can include with a single line. The engine identifies swing points on H4 using a configurable lookback and strength, labels each swing HH, LH, HL, or LL as it forms, tracks the labeled sequence to determine market structure, and exposes a clean public interface for querying the current trend and retrieving the swing array—all while drawing correctly on whatever lower timeframe chart the calling code is attached to.

The central question CSwingEngine is designed to answer is this:

What is the higher-timeframe market structure, and what does the labeled sequence of swing points tell us about where a valid pattern can form on the timeframe I actually trade?

Automating Chart Patterns in MQL5 (Part 1)

Author: Tola Moses Hector