Loading…

Harmonic Pattern Scanner

Harmonic patterns describe five points - X, A, B, C, D - connected by four legs, where each leg's length relative to the others is expected to sit close to specific Fibonacci ratios. Four of the commonly traded patterns (Gartley, Bat, Butterfly, Crab) are really the same five-point shape with different published ratio bands. This indicator builds its swing points the same way the other structure tools in this catalogue do - strict confirmed fractals, same-side runs collapsed to their most extreme point so the result is a clean alternating zigzag - then, every time a new swing confirms and becomes the newest point D, tests the four preceding swings as X, A, B and C against all four ratio bands in order and reports the first one the structure fits inside. Two things are worth being honest about. First, harmonic pattern recognition is inherently approximate - the published ratios are targets, not laws, and every real implementation applies some tolerance around them. This one uses a single configurable tolerance applied to every ratio check, rather than four different hand-tuned bands, which keeps the behaviour predictable at the cost of not perfectly matching any one author's exact tolerance scheme. Second, D being ratio-complete is not the same as D being a confirmed reversal - this indicator identifies structures whose geometry matches a named pattern, full stop. It does not wait for a reversal candle or any other confirmation beyond the swing itself being fractal-confirmed, and it does not rank pattern quality beyond which single band the ratios fell inside first (checked in the order Gartley, Bat, Butterfly, Crab, so a structure that could arguably fit two overlapping bands is only ever counted once). Notes and limitations - Only Gartley, Bat, Butterfly and Crab are checked. Other published harmonic shapes (Shark, Cypher, and others) use different ratio bands and are not covered. - D is fixed InpSwingBars bars after it forms, same lag as every other fractal-based tool in this catalogue - this is a structure-identification tool, not a same-bar entry trigger, and it does not itself confirm that price actually reverses at D. - The ratio bands are read from commonly published values; different sources vary slightly on the exact numbers, particularly for Bat and Crab. Treat the classification as a label, not a certification. - Only one XABCD structure is drawn per completed D point - the indicator does not attempt to find every possible historical structure across the full chart at once, only the one ending at each newly confirmed swing.

Indicator · MT4 · v1.0 · Free

About Harmonic Pattern Scanner

Harmonic Pattern Scanner is an indicator for MetaTrader 4. It draws buy and sell arrows on the chart and can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Swing bars, Ratio tolerance and Show legs. MQL source code included.

Files in the download: HarmonicPatterns.ex4, HarmonicPatterns.mq4, HarmonicPatterns.txt.

Settings

SettingDefaultWhat it does
Swing bars5Bars each side required to confirm a swing
Ratio tolerance0.06Tolerance around a target Fibonacci ratio (0.06 = 6%)
Show legstrueDraw the X-A-B-C-D connecting legs
AlertstrueAlert once, when a new pattern's D point confirms

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Fibonacci · Harmonic Patterns · Dashboards & Scanners · Buy/Sell Arrows · Alerts · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria