Don`t read this thread..Make Money with it. - page 28

 

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

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

Most chart pattern implementations share the same limitation. They detect the shape. They do not detect the context. A head and shoulders pattern found at the top of a confirmed uptrend is a high-probability reversal signal. The same shape found in the middle of a sideways range is noise. A double top after three or more consecutive higher highs is a structural warning. A double top after a single rally leg that barely qualifies as a trend is questionable at best. Every experienced technician knows this distinction. Almost no automated implementation enforces it.
Automating Chart Patterns in MQL5 (Part 1): The Multi-Timeframe Swing Structure Engine
Automating Chart Patterns in MQL5 (Part 1): The Multi-Timeframe Swing Structure Engine
  • 2026.08.25
  • www.mql5.com
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.