Fractal ZigZag No Repaint Indicator: Depth, Deviation, Backstep

Written by Dominic Walsh · Published · Last updated

The fractal zigzag no repaint indicator draws a single ZigZag line. It scans each bar for a local high or low against its Depth window of neighbors. Deviation filters out small wiggles. Backstep spaces the swing points apart, so the line traces only the larger turns.

This build ships as fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.ex4 for MT4 and fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.ex5 for MT5; the screenshots below come from EURUSD H1.

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

What the Fractal ZigZag No repaint Indicator draws on the chart

ZigZag (salmon) connects confirmed swing highs and lows. It plots only at bars the code accepts as a new pivot.

  • ZigZag: plot, salmon
EURUSD H1 chart: the fractal zigzag no repaint indicator tracing confirmed swing highs and lows.
EURUSD H1 chart: the fractal zigzag no repaint indicator tracing confirmed swing highs and lows.

How the Fractal ZigZag No repaint Indicator calculates its values

Finding a local extreme

Every bar gets checked against its neighbors. For each bar i from Depth onward, the code scans the Depth bars around it for the highest high and lowest low in that window.

A bar counts as a local high when its own high matches or beats every high in the window. The low side works the same way. Depth defaults to 30, so the scan looks fairly wide before it calls any bar a candidate.

Deviation and Backstep filters

Three checks confirm a candidate high. The trend must not already be up, the move away from the last confirmed low must clear Deviation points, and Backstep bars must have passed since the last confirmed high. The low side mirrors all three checks.

Deviation defaults to 7 points, and Backstep defaults to 2 bars. A turn needs both a minimum size and a minimum spacing before the line commits to it.

One trend flag blocks duplicate pivots

A single trend variable tracks whether the last confirmed point was a high or a low. A new high can only confirm when trend is not already 1, and a new low can only confirm when trend is not already -1.

That stops the line from marking two highs in a row with no low between them. Every confirmed swing has to alternate direction from the one before it.

How to read the signals

Each plotted point is a confirmed swing. Unconfirmed candidates never appear on the ZigZag line at all.

A rising sequence of points reads as higher highs and higher lows. A falling sequence reads as the mirror image.

Backstep enforces a minimum gap between points. The line will not mark two swings that sit too close together in time.

Confirmed points always alternate between a high and a low. The trend flag in the code blocks two highs, or two lows, from confirming back to back.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

EnableAlerts turns on popup, push, email and sound alerts together. The cross check behind them runs once per newly closed bar.

Every Fractal ZigZag No repaint Indicator input

Core settings

Setting What it does Default
Depth Depth sets how many bars the code checks around each bar for a local extreme. It defaults to 30. 30
Deviation Deviation sets the minimum point move a swing needs before it counts as a real turn. It defaults to 7. 7
Backstep Backstep sets the minimum bar gap between two confirmed swing points. It defaults to 2. Two confirmed points on opposite sides can still sit closer together than Backstep, since the rule only limits spacing between points on the same side. 2

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Inputs panel for the fractal zigzag no repaint indicator, showing Depth, Deviation and Backstep.
Inputs panel for the fractal zigzag no repaint indicator, showing Depth, Deviation and Backstep.

Settings that fit your chart

The screenshot runs on EURUSD H1. The default Depth of 30 and Deviation of 7 points settle on swings that span several hours. Lowering Depth or Deviation brings the line closer to price on lower timeframes. Raising either one thins it out for a slower read. A wider Depth on a higher timeframe filters out most of the small pullbacks that a shorter setting would still mark.

When the Fractal ZigZag No repaint Indicator fails

The newest ZigZag point can still shift. Price keeps testing the same Depth window, so the last visible leg is the least reliable one to trade off.

A strong one-directional run can hide gaps. With no pullback bigger than Deviation, the line will not print a single swing point along the way.

The scan checks Depth bars around every single bar on the chart, so a very large Depth adds real work per bar without changing what counts as a local extreme.

Depth, Deviation and Backstep all interact. Loosening one without checking the others can produce more swing points than a trader actually wants to read on a busy chart.

Copy fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.ex4 into MQL4/Indicators and fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.ex5 into MQL5/Indicators, then restart the terminal and drag the Fractal ZigZag No repaint Indicator onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Fractal ZigZag No repaint Indicator for MT4 and MT5

The zip fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.zip holds fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.ex4, fractal-zigzag-no-repaint-indicator-mt5-indicator-forexmt4systems.ex5 and a short README, compiled files only. 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

What does the Depth input actually search for?

Depth sets how many bars the code checks on either side of a candidate bar. The default is 30. A smaller Depth accepts smaller local extremes as candidates. A larger Depth demands a bar stand out over a wider stretch before it even becomes a candidate. Backstep, separately, only limits how close two points on the same side can sit in time.

How does Deviation decide whether a swing counts?

Deviation, 7 points by default, sets the minimum distance a candidate swing must move away from the last confirmed point on the opposite side. A candidate high sitting only 3 points above the last confirmed low would not clear a Deviation of 7. Deviation is measured in points, so its effect also depends on the pair’s own typical range.

Why would I raise Backstep above its default of 2?

Backstep enforces a minimum bar gap between two confirmed swing points on the same side. Raising it past 2 forces the ZigZag to space its highs, or its lows, further apart in time. That thins out closely bunched swings, at the cost of missing some smaller turns. A trader can raise Backstep and Deviation together for a cleaner, slower read on a higher timeframe.

Does the ZigZag line ever repaint an already confirmed swing point?

Once a point clears Deviation and Backstep, the code writes it to the ZigZag buffer and that bar’s value stays fixed. Only the most recent, still-open leg can keep extending as new bars arrive, which is normal for a ZigZag tool. That is normal behavior for any ZigZag style indicator, not a defect specific to this build.

Can the ZigZag line mark two swing highs in a row with no low between them?

No. A single trend flag in the code tracks whether the last confirmed point was a high or a low. A new high can only confirm while that flag is not already set to high, and the low side works the same way in reverse. Confirmed points always alternate between a high and a low as a result.

Are results guaranteed?

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

Category: this is part of our Support and Resistance collection. Then, plainly, browse more Support and Resistance 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