Discussing the article: "Automating Trading Strategies in MQL5 (Part 29): Creating a price action Gartley Harmonic Pattern system"
This article is a very good educational example for learning how to structure an EA and visualize harmonic patterns in MQL5.
Just one clarification for readers: although the introduction says "you'll have a powerful strategy ready for customization", this should not be taken as a trading-ready system.
The main reasons are:
- Incomplete Gartley definition: the code checks only that point D is around 0.786 of XA. In harmonic trading, the key idea is the Potential Reversal Zone (PRZ), which requires confluence of multiple ratios (for example 0.786 XA together with 1.27–1.618 of BC). Without that, many false patterns appear.
- Stop Loss / Take Profit rules: here they are defined as simple fractions of the move towards C. In harmonic trading the stop is usually placed beyond X, and targets are based on Fibonacci retracements of AD. If this is not followed, the risk/reward becomes arbitrary.
So, as an exercise in coding and visualization, it's excellent. But for actual trading, a beginner should understand that more rules and validations are needed before relying on such a program.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Automating Trading Strategies in MQL5 (Part 29): Creating a price action Gartley Harmonic Pattern system.
In this article, we develop a Gartley Pattern system in MQL5 that identifies bullish and bearish Gartley harmonic patterns using pivot points and Fibonacci ratios, executing trades with precise entry, stop loss, and take-profit levels. We enhance trader insight with visual feedback through chart objects like triangles, trendlines, and labels to clearly display the XABCD pattern structure.
The Gartley pattern is a harmonic trading formation defined by five key swing points—X, A, B, C, and D—and exists in two forms: a bullish pattern and a bearish pattern, each designed to identify high-probability reversal zones using specific Fibonacci ratios. In a bullish Gartley, the structure forms a low-high-low-high-low sequence where point X is a swing low, point A a swing high, point B a swing low (retracing approximately 0.618 of XA), point C a swing high (extending 0.382 to 0.886 of AB), and point D a swing low (retracing 0.786 of XA, positioned above X). Conversely, a bearish Gartley forms a high-low-high-low-high sequence, with point X as a swing high, point A a swing low, point B a swing high, point C a swing low, and point D a swing high (retracing 0.786 of XA, positioned below X). Below are the visualized pattern types.
Bullish Gartley Harmonic Pattern:
Bearish Gartley Harmonic Pattern:
Author: Allan Munene Mutiiria