Discussing the article: "Price Action Analysis Toolkit Development (Part 39): Automating BOS and ChoCH Detection in MQL5"

 

Check out the new article: Price Action Analysis Toolkit Development (Part 39): Automating BOS and ChoCH Detection in MQL5.

This article presents Fractal Reaction System, a compact MQL5 system that converts fractal pivots into actionable market-structure signals. Using closed-bar logic to avoid repainting, the EA detects Change-of-Character (ChoCH) warnings and confirms Breaks-of-Structure (BOS), draws persistent chart objects, and logs/alerts every confirmed event (desktop, mobile and sound). Read on for the algorithm design, implementation notes, testing results and the full EA code so you can compile, test and deploy the detector yourself.

We use fractal pivots as reliable local anchors and detect two complementary signals: ChoCH (Change of Character), which flags when the market is losing its prior bias—for example when an uptrend fails to make a higher high or a downtrend fails to make a lower low—and BOS (Break of Structure), which confirms that the bias has shifted when price decisively closes beyond a prior swing high or low. Think of ChoCH as an early warning and BOS as the confirmation.

CHoCH and BOS

Combining fractals with ChoCH/BOS gives cleaner, non-repainting anchors for analysis, earlier warning of potential reversals, and multi-timeframe clarity that helps filter noise on lower charts. Those same rules are straightforward to automate, log and backtest—which makes them ideal for an EA.

This article walks through the algorithm design and the full MQL5 implementation: closed-bar fractal scanning, memory-safe fractal storage, safe drawing of persistent objects, and event handling that logs and alerts every confirmed BOS/ChoCH (desktop, mobile, and sound). By the end you’ll have a production-ready detector you can compile, test, and deploy.

Author: Christian Benjamin