Discussing the article: "Automating Trading Strategies in MQL5 (Part 33): Creating a Price Action Shark Harmonic Pattern System"

 

Check out the new article: Automating Trading Strategies in MQL5 (Part 33): Creating a Price Action Shark Harmonic Pattern System.

In this article, we develop a Shark pattern system in MQL5 that identifies bullish and bearish Shark harmonic patterns using pivot points and Fibonacci ratios, executing trades with customizable entry, stop-loss, and take-profit levels based on user-selected options. We enhance trader insight with visual feedback through chart objects like triangles, trendlines, and labels to clearly display the X-A-B-C-D pattern structure.

The Shark pattern is a harmonic trading formation defined by five key swing points—X, A, B, C, and D—existing in bullish and bearish forms, designed to identify high-probability reversal zones through specific Fibonacci retracements and extensions. In a bullish Shark pattern, the structure forms a low-high-low-high-low sequence where X is a swing low, A a swing high, B a swing low (retracing 0.32 to 0.50 of XA), C a swing high (extending 1.13 to 1.618 of AB), and D a swing low (extending 1.618 to 2.24 of BC, below B); a bearish Shark reverses this sequence with D above B. Here is a visualization of the patterns:

Bearish Harmonic Shark pattern:

BEARISH HARMONIC SHARK PATTERN

Bullish Harmonic Shark pattern:

BULLISH HARMONIC SHARK PATTERN

Our approach involves detecting these swing pivots within a specified bar range, validating the pattern’s legs against user-defined Fibonacci criteria, visualizing the X-A-B-C-D structure with chart objects like triangles and trendlines, and executing trades at the D point with customizable stop loss (Fibonacci-based or fixed) and take-profit levels (one-third, two-thirds, or C pivot) to capitalize on anticipated reversals. Let’s proceed to the implementation!

Author: Allan Munene Mutiiria