Harmonic Patterns Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Depth decides how many patterns exist. The harmonic patterns indicator runs a three-bar skeleton, which is about as shallow as the rule goes, so it finds a great many five-point shapes across its scan window. A cap on how many get drawn is the counterweight.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 3: ZigZag, BuyArrow, SellArrow
Alerts popup, push notification, email, sound
Inputs 11

The plots and where they sit

A skeleton and two marks on price.

`ZigZag` traces silver as connected sections.

`BuyArrow` prints lime using arrow 233.

`SellArrow` prints red using arrow 234.

Legs and labels draw as chart objects.

Nothing appears in a pane below.

  • ZigZag: section, silver, width 1
  • BuyArrow: arrow, lime, width 2, arrow code 233
  • SellArrow: arrow, red, width 2, arrow code 234
harmonic patterns indicator: A completed five-point shape marked, EURUSD H1.
A completed five-point shape marked, EURUSD H1.

The steps it takes

A shallow skeleton

`ZigZagDepth` `3` bars either side define a turn. Three is a low bar to clear, so the skeleton picks up minor swings as well as major ones.

Five points, four legs

The code takes consecutive alternating turns five at a time. It measures each leg and divides one against another to produce the ratios that decide which shape this is.

How close counts

`Tolerance` `0.30` is generous. A ratio can land nearly a third away from the textbook figure and still pass, which is the single most important setting here.

How to take a reading

Marks land on the final turn of a shape.

Silver sections show which five points it picked.

`MaxPatterns` `40` caps how many stay on the chart.

`LookbackBars` `600` bounds the search.

`EnableFallback` `true` accepts a looser match.

Tightening the tolerance cuts the count sharply.

Alert channels in this build: popup, push notification, email and sound.

A completed shape is what reports. `EnableAlerts` decides whether it speaks and a dialog already arrives in the terminal, while the phone route, the mail route and the clip named by `SoundFile` all start closed.

Every Harmonic Patterns Indicator input

Core settings

Setting What it does Default
ZigZagDepth How many bars flank each turn, `3`. 3
LookbackBars History the search covers, `600`. 600
Tolerance How far a ratio may stray, `0.30`. 0.30
EnableFallback Accept a looser match when none fits, `true`. on
MaxPatterns Shapes kept on the chart, `40`. 40

Alert settings

Setting What it does Default
EnableAlerts Whether a completed shape speaks, `true`. on
EnablePopup A dialog arrives in the terminal, `true`. on
EnablePushNotify It reaches a phone as well, `false`. off
EnableEmail It arrives by mail, `false`. off
EnableSound (see inputs panel) off
SoundFile Audio the desktop reaches for, `”alert.wav”`. alert.wav
harmonic patterns indicator: Inputs panel, Tolerance beside the depth setting.
Inputs panel, Tolerance beside the depth setting.

Choosing well

Six hundred bars with a three-bar skeleton finds plenty. EURUSD H1 is the reference chart, covering about twenty-five days. On M5 the turns are noise and the count explodes. On H4 each shape spans a month or more.

When it misleads

A shallow skeleton finds shapes almost everywhere.

Nearly a third of tolerance accepts loose matches.

The fallback setting loosens things further still.

Forty shapes on one chart is a lot to judge.

Copy the compiled Harmonic Patterns Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Background reading on the method behind the Harmonic Patterns Indicator: Harmonic Price Patterns at BabyPips, Zig Zag Indicator at Investopedia.

Download the Harmonic Patterns Indicator for MT4 and MT5

The zip holds the compiled Harmonic Patterns Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

How loose is Tolerance 0.30 in practice?

Very. A leg meant to sit at 0.618 would pass anywhere from roughly 0.32 to 0.92, which covers most of the range a leg can actually take. Tightening this is the first change worth making.

What does EnableFallback true allow?

A looser match when no named shape fits the measured ratios cleanly. It produces more marks, which is useful for exploring and unhelpful if you want only textbook examples on the chart.

Why does ZigZagDepth 3 find so many shapes?

Because three bars either side is a low threshold for a turn. The skeleton therefore includes minor swings, and five-point combinations of those can be found across almost any stretch of price.

What is MaxPatterns 40 protecting against?

Chart clutter. At this depth and tolerance the search finds far more than forty across six hundred bars, so the cap keeps the drawing readable rather than limiting what gets detected.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Harmonic Patterns Indicator as one input. Always backtest before trading live.

Category: this is part of our Signal and Forecast collection. Also, truly, browse more Signal and Forecast for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment