The auto harmonic pattern indicator hands you the ratio definitions instead of hiding them. `AbLo` and `AbHi` bound the AB leg, `BcLo` and `BcHi` bound BC, and `CdLo` with `CdHi` bound CD. `RatioTol` then widens all three. Change those six numbers and you change which patterns exist.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H4.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 3: XABCD, Buy, Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 16 |
What the Auto Harmonic Pattern Indicator draws on the chart
XABCD is the teal zigzag joining the five pivots of a matched structure.
Buy places a lime arrow at point D of a bullish match.
Sell places a red arrow at point D of a bearish one.
An OBJ_TEXT label sits beside the structure.
- XABCD: zigzag, teal, width 2
- Buy: arrow, lime, width 4, arrow code 233
- Sell: arrow, red, width 4, arrow code 234

How the Auto Harmonic Pattern Indicator calculates its values
Collecting the pivots
IsFractalHigh and IsFractalLow test each bar with `Depth` `7` bars on either side. Confirmed pivots go into a list up to `MaxPivots` `40` long. The list alternates, so five consecutive entries always give an XABCD shape.
Measuring the three ratios
XA, AB, BC and CD take the absolute price distance of each leg. ab divides AB by XA, bc divides BC by AB, and cd divides CD by BC. Three numbers then describe the whole structure.
Testing against your bands
ab must land between `AbLo` `0.55` and `AbHi` `0.65`, widened either side by `RatioTol` `0.12`. bc and cd get the same treatment against their own pairs. All three must pass together for a match.
How to read the signals
The default bands describe one family of structures rather than four named ones.
Every arrow sits at point D, which confirms `Depth` bars after the fact.
Widening `RatioTol` finds more matches and lowers what each one means.
The zigzag shows exactly which five pivots the match used.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Four channels sit under `EnableAlerts`, which starts on. Only `EnablePopup` is live alongside it, while `EnablePushNotify`, `EnableEmail` and `EnableSound` begin false. `SoundFile` picks the clip. One match message follows each closed bar.
Every Auto Harmonic Pattern Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
Depth |
Bars each side of a fractal pivot, default `7`. | 7 |
MaxPivots |
How many pivots the list holds, default `40`. | 40 |
AbLo |
Lower bound for the AB leg ratio, default `0.55`. | 0.55 |
AbHi |
Upper bound for the AB leg ratio, default `0.65`. | 0.65 |
BcLo |
Lower bound for the BC leg ratio, default `0.3`. | 0.3 |
BcHi |
Upper bound for the BC leg ratio, default `0.9`. | 0.9 |
CdLo |
Lower bound for the CD leg ratio, default `1.2`. | 1.2 |
CdHi |
Upper bound for the CD leg ratio, default `1.65`. | 1.65 |
RatioTol |
Extra tolerance applied to every band, default `0.12`. | 0.12 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPoints |
Mark distance from the bar in points, default `50`. | 50 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Master switch for the ratio match alerts, default `true`. | on |
EnablePopup |
Terminal dialog on a ratio match, default `true`. | on |
EnablePushNotify |
Phone push on a ratio match, default `false`. | off |
EnableEmail |
Mail delivery on a ratio match, default `false`. | off |
EnableSound |
Sound playback on a ratio match, default `false`. | off |
SoundFile |
Wav clip for the match alert, default `alert.wav`. | alert.wav |

Settings that fit your chart
EURUSD H4 is the reference chart, chosen because the pattern legs separate cleanly there. `Depth` at `7` picks pivots that took most of a day to form. On H1 the same setting finds smaller structures more often. Below M15 five pivots fit inside a session and mean very little.
When the Auto Harmonic Pattern Indicator fails
Six band inputs plus a tolerance means two traders can get completely different results.
A wide `RatioTol` turns almost any five pivots into a match.
Point D confirms `Depth` bars late, so the structure completes well before you see it.
Copy the compiled Auto Harmonic Pattern 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 Auto Harmonic Pattern Indicator: Chart pattern on Wikipedia, Candlesticks And Resistance at StockCharts ChartSchool.
Download the Auto Harmonic Pattern Indicator for MT4 and MT5
The zip holds the compiled Auto Harmonic Pattern 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.
FAQ
What do AbLo and AbHi actually bound?
The AB leg measured against XA. At `0.55` and `0.65` the AB leg must retrace between 55 and 65 percent of XA, before `RatioTol` widens it. That band sits around the 0.618 ratio most harmonic definitions use.
How does RatioTol widen AbLo and AbHi?
It widens all three at once. `RatioTol` `0.12` subtracts from every low bound and adds to every high bound. So the AB band effectively runs from 0.43 to 0.77. Tighten it before narrowing the bands themselves.
Why does Depth default to 7?
It suits the H4 reference chart, where seven bars on each side means a pivot took over a day to form. That keeps the pivot list to turns worth building a structure from. Lower it on faster charts, and expect many more matches.
What does the XABCD plot show?
The five pivots the match used, joined as a zigzag in teal. Without it a lone arrow gives you no way to check the structure. Comparing the shape against the ratio bands is the quickest way to judge a match.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Auto Harmonic Pattern Indicator as one input. Always backtest before trading live.
Category: this is part of our Support and Resistance collection. Also, still, hence, plainly, truly, browse more Support and Resistance for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- Learn more about the underlying method in Chart pattern on Wikipedia.
- For wider market background, see Candlesticks And Resistance at StockCharts ChartSchool.
