Discussing the article: "Automating Trading Strategies in MQL5 (Part 44): Change of Character (CHoCH) Detection with Swing High/Low Breaks"

 

Check out the new article: Automating Trading Strategies in MQL5 (Part 44): Change of Character (CHoCH) Detection with Swing High/Low Breaks.

In this article, we develop a Change of Character (CHoCH) detection system in MQL5 that identifies swing highs and lows over a user-defined bar length, labels them as HH/LH for highs or LL/HL for lows to determine trend direction, and triggers trades on breaks of these swing points, indicating a potential reversal, and trades the breaks when the structure changes.

It's a price action concept that signals a potential trend reversal when price breaks through a recent swing high or low in a way that contradicts the established trend direction. We identify swing highs (points higher than surrounding bars) and swing lows (lower than surroundings), then label them based on comparison to the prior swing: HH (higher high) or LH (lower high) for highs, LL (lower low) or HL (higher low) for lows.

A sequence of HH/HL indicates an uptrend, while LH/LL signals a downtrend; CHoCH occurs when price breaks the most recent swing high during a downtrend (bullish reversal) or the recent swing low during an uptrend (bearish reversal), showing a "change" as buyers/sellers gain control. In a downtrend (defined by LH or LL), a bullish CHoCH triggers when price closes above the recent swing high, confirming buyers have overwhelmed the prior structure—enter buy with stop-loss below the break level. Conversely, in an uptrend (HH or HL), a bearish CHoCH triggers on a close below the recent swing low, entering sell with stop-loss above and take-profit downward.

Our plan is to scan bars around each new candle to detect and label swing highs/lows as HH/LH/LL/HL, determine current trend from label sequences, trigger CHoCH buys on breaks above highs in downtrends or sells below lows in uptrends, limit total open trades, apply fixed point trade with adjustable risk-to-reward (R:R) ratios, include optional points-based trailing stops after a profit threshold, and visualize with colored icons/labels on swings plus arrowed lines/text on CHoCH breaks, with dynamic font sizing for chart scale changes. In a nutshell, here is a visual representation of our objectives.

CHoCH FRAMEWORK


Author: Allan Munene Mutiiria