The non repaint harmonic pattern indicator works from confirmed pivots rather than live ones. Five of them make an XABCD structure. The code measures the ratios between the legs and compares them against the Gartley, Bat, Butterfly and Crab definitions, allowing `InpTolerance` either side.
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 | 4: Harmonic Buy, Harmonic Sell, PivotHigh, PivotLow |
| Alerts | popup, push notification, email, sound |
| Inputs | 12 |
What the Non repaint harmonic pattern Indicator draws on the chart
PivotHigh and PivotLow are dodger blue and dark orange dots at each confirmed turn.
Harmonic Buy places a lime arrow at point D of a bullish pattern.
Harmonic Sell places a red arrow at point D of a bearish one.
OBJ_TREND segments join X to A to B to C to D, with an OBJ_TEXT naming the pattern.
- Harmonic Buy: arrow, lime, width 2, arrow code 233
- Harmonic Sell: arrow, red, width 2, arrow code 234
- PivotHigh: arrow, dodger blue, width 1, arrow code 159
- PivotLow: arrow, dark orange, width 1, arrow code 159

How the Non repaint harmonic pattern Indicator calculates its values
Locking the pivots
A pivot needs `InpPivotDepth` `5` bars on each side. The code only accepts one once those five newer bars have closed. Point D confirms the same way, which is where the non-repaint claim comes from.
Measuring the legs
The code holds five pivots at a time, alternating high and low. It then takes the ratio of each leg against the one before. Those ratios are what separate a Gartley from a Bat or a Crab.
Allowing a tolerance
`InpTolerance` `0.12` sets how far a ratio may sit from the book value and still count. Real price never lands exactly on 0.618. Too tight a tolerance finds nothing, and too loose a one finds patterns everywhere.
How to read the signals
The dots show the pivot sequence, and the segments show which five the pattern used.
An arrow always sits at point D, five bars after that pivot formed.
Widen `InpLookback` to let the scan reach older pivots.
Tighten `InpTolerance` toward 0.05 if the chart finds patterns you would reject by eye.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
`EnableAlerts` starts on with `EnablePopup`, `EnablePushNotify` and `EnableSound` all true, while `EnableEmail` is false. `SoundFile` picks the clip. Patterns confirm on closed bars, and the guard allows one completion message per bar.
Every Non repaint harmonic pattern Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpPivotDepth |
Pivot depth (bars each side). Bars each side of a pivot, default `5`. | 5 |
InpLookback |
Lookback bars for scan. Bars the pattern scan covers, default `200`. | 200 |
InpTolerance |
Fib ratio tolerance (+/-). How far a ratio may sit from the book value, default `0.12`. | 0.12 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ShowPivotMarkers |
Plot small markers at pivots. Draws the small pivot dots, default `true`. | on |
DrawPatternLines |
Draw X-A-B-C-D segments. Draws the XABCD segments, default `true`. | on |
ArrowOffsetPips |
Arrow vertical offset (pips). Arrow distance from the bar in pips, default `8`. | 8 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Master alert toggle. Master switch for the pattern completion alerts, default `true`. | on |
EnablePopup |
Popup alert. Terminal dialog on a completed pattern, default `true`. | on |
EnablePushNotify |
Mobile push notification. Phone push on a completed pattern, default `true`. | on |
EnableEmail |
Email alert. Mail delivery on a completed pattern, default `false`. | off |
EnableSound |
Sound alert. Sound playback on a completed pattern, default `true`. | on |
SoundFile |
Wav clip for the pattern alert, default `alert.wav`. | alert.wav |

Settings that fit your chart
Harmonic structures need room across five pivots. EURUSD H1 is the reference chart, where `InpLookback` at `200` covers eight days. On M5 five pivots fit inside a session and the patterns mean very little. On H4 and daily each structure spans weeks, which is closer to the original work.
When the Non repaint harmonic pattern Indicator fails
Five confirmed pivots take a long time to form, so a pattern completes well after point D.
A tolerance of 0.12 is generous, and different tools disagree on what counts as a valid ratio.
Point D confirming does not mean price turns there. It means the shape finished.
Copy the compiled Non repaint 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 Non repaint harmonic pattern Indicator: Shelf registration on Wikipedia, ivolumes (VOLUMES) at the MQL5 Documentation.
Download the Non repaint harmonic pattern Indicator for MT4 and MT5
The zip holds the compiled Non repaint 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 does InpTolerance at 0.12 allow?
A ratio may sit 0.12 either side of its book value and still count. So a leg meant to reach 0.618 passes anywhere between roughly 0.50 and 0.74. Tighten it toward 0.05 for stricter matching and far fewer patterns.
Which patterns does InpTolerance match against?
Gartley, Bat, Butterfly and Crab. All four are five-point XABCD structures and differ only in the ratios between legs. The code checks each set against the measured ratios and names the match in the chart text.
How late does InpPivotDepth make point D?
Five bars. A pivot cannot confirm until `InpPivotDepth` `5` newer bars have closed on the correct side. On EURUSD H1 that is five hours after the low or high that completes the pattern.
What do the DrawPatternLines segments show?
The five pivots the pattern used, joined X to A to B to C to D. Without them a lone arrow tells you nothing about which structure produced it. Turn them off with `DrawPatternLines` on a crowded chart.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Non repaint harmonic pattern Indicator as one input. Always backtest before trading live.
Category: this is part of our Support and Resistance collection. Browse more Support and Resistance for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in Shelf registration on Wikipedia.
- Additional market context is at ivolumes (VOLUMES) at the MQL5 Documentation.
