MQL5 TRADINGS ROBOTS
In our previous article (Part 43), we developed an adaptive Linear Regression Channel strategy in MetaQuotes Language 5(MQL5) that calculates regression lines with deviation bands, activated only on sufficient slope, extended or recreated dynamically on deviations, supported normal/inverse modes, opened on breakouts from inside, closed on middle-line crosses, limited positions, and visualized filled zones with labels/arrows. In Part 44, we develop a Change of Character (CHoCH) detection system with swing high/low breaks.
This system scans bars to identify and label swing highs/lowsas HH/LH/LL/HL for trend determination, trades on breaks signaling reversals (buys above highs in downtrends, sells below lows in uptrends), offers per-bar/tick modes, fixed trade levels with risk to reward ratios, trade limits, trailing stops, and visuals with icons, labels, and break lines plus dynamic fonts. We will cover the following topics:
By the end, you’ll have a functional MQL5 strategy for detecting and trading CHoCH reversals with customizable scans, risk management, and clear visual feedback—let’s dive in!
Understanding the Change of Character (CHoCH) Strategy
It's a price action concept that signals a potential trend reversal when price breaks through a recent swing high or lowin 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.
2023.10.13 14:28
MetaQuotes has launched new MQL5.community information channels on Facebook, X.com (Twitter), and Telegram. These channels provide daily publications of relevant technical materials from the MQL5.com Articles and CodeBase sections. They are designed to promptly update developers on algorithmic trading innovations, share current technological trends, and assist subscribers in solving any difficulties they may encounter. There's no need to manually check MQL5.com thematic sections: get the most useful and interesting content delivered directly to your favorite app's news feed.

The idea of this project was prompted by popular requests from the community. Furthermore, it aligns perfectly with MetaQuotes' commitment to the global popularization and advancement of algorithmic trading. With years of investment in algorithmic trading projects, the launch of the new information channels serves as a logical continuation of our initiatives.
The new channels deliver English-language content in a developer-to-developer format. No advertising, spam, or irrelevant publications — only the latest articles addressing real issues. This content will be particularly useful for those who work with the MQL5 language.
Subscribe now to ensure you never miss out on important updates.
No comments:
Post a Comment