The ZigZag Indicator: It Repaints By Design, and That Is the Whole Story
The ZigZag draws perfect lines between every high and low on your chart. It does that because it is allowed to change its mind about where the last high or low was, right up until the moment it stops being the last one. Everything else about this indicator follows from that.
In one sentence:
It joins significant highs and lows with straight lines, and it is permitted to move the most recent line as new prices arrive, which is why it always looks right in hindsight and can never be traded live.
ZigZag at a glance
| Difficulty | Beginner to set up, and one of the most misunderstood tools in retail trading |
| What it draws | Straight lines connecting swing highs to swing lows, filtered by a significance rule |
| Does it repaint? | Yes, by design. The final leg redraws as price moves and can be deleted entirely. This cannot be fixed or configured away |
| Can it be used for entries? | No. The signal you would act on is the part that is still allowed to change |
| Are ZigZag backtests valid? | No. The strategy tester recalculates the indicator over full history, so the test sees final pivots that were not knowable at the time |
| MT5 location | Bundled with MT5, but as a custom indicator: Navigator → Indicators → Examples → ZigZag. It is not in the Insert → Indicators groups with the standard set |
| Settings | Depth (default 12), Deviation (default 5), Backstep (default 3) |
| Legitimate uses | Visual swing identification, measuring past leg sizes, labelling completed structure, teaching |
What it is and why it works
Here is the mechanism, and once you have it, everything else about the ZigZag becomes obvious.
The indicator scans the chart looking for turning points that are “significant enough” by a rule you set. In the standard MetaTrader version there are three parameters: Depth, the minimum number of bars it will look back to find an extreme; Deviation, how far price must reverse before a new turning point counts; and Backstep, how many bars must separate two consecutive pivots. When a bar satisfies these rules, the ZigZag places a pivot there and draws a straight line from the previous pivot to it.
Now the critical part. Suppose the market is rising and the ZigZag has provisionally placed a pivot at yesterday’s high. Today price makes a higher high. That old pivot is no longer the highest point, so the ZigZag deletes it and moves the pivot to today’s high. The line redraws. Tomorrow price goes higher again, and it moves again. The last leg of a ZigZag is provisional. It can extend, it can retract, and it can be deleted entirely. Only once price has reversed far enough to establish the next pivot does the previous one become fixed, and at the moment you are looking at your chart, you have no way of knowing whether the leg in front of you is one of the fixed ones or the provisional one.
This is what people mean when they say the ZigZag repaints. It is not a flaw in a particular version, not something a better coder could fix, and not something a setting controls. Redrawing the last leg is the definition of the indicator. An indicator that identified the true swing extreme before the swing had finished would be predicting the future, and none do.
So the ZigZag is a drawing tool. It applies a consistent rule for what counts as a swing and it renders the result cleanly, which makes it genuinely useful for looking at a market’s past shape. It is not an analysis tool, not a signal generator, and not something an automated system can be built on. Retail trading is full of ZigZag-based strategies, courses and expert advisors with astonishing backtest results, and every one of those results is an artefact of the indicator being allowed to revise history.
How to trade it, step by step
- Add it from the right place. The ZigZag is not in the main MT5 indicator menu. Open the Navigator panel, expand Indicators, then Examples, and drag ZigZag onto the chart. It ships with the platform but sits with the bundled custom indicators rather than the standard ones.
- Understand the three settings before you change any of them. Depth is the minimum bars looked back for an extreme, Deviation is how far price must reverse for a new pivot to count, and Backstep is the minimum bar separation between pivots. Raising all three produces fewer, larger legs. Lowering them produces more, smaller ones.
- Set them for the swing size you actually care about, then leave them. If you trade daily structure, increase Depth until the ZigZag only marks turns you would have called turns yourself. Changing the settings until the lines look good on the chart in front of you is fitting, not analysis, and the fitted settings will look wrong next month.
- Look at the last leg and mentally mark it as provisional. This is the habit that separates people who use the ZigZag safely from people who lose money with it. The rightmost line on your chart is not a conclusion. It is the indicator’s current best guess, and it will change if price keeps going.
- Use it to read completed structure. Look at the legs that are two or more pivots back; these are fixed. Are the highs getting higher and the lows getting higher? That is an uptrend by the definition in market structure, and the ZigZag has just made it unmistakable. That is a legitimate and useful thing to do.
- Use it to measure, not to signal. Read the sizes of past legs. How far does this instrument typically run before it reverses? How long do legs last in bars? That measurement is genuinely useful for setting realistic targets, and it uses only completed, fixed legs.
- Take your actual entries from something that does not revise. Levels from structure, fractals read with their proper two-bar offset, closed-bar breaks of a marked price, anything where what you saw is what stays on the chart. The ZigZag can tell you where to look. It must never tell you when to act.
- Never build or buy an automated system based on it. If an expert advisor uses ZigZag pivots, its backtest is reading pivots that were finalised with information from after the trade. The equity curve will be beautiful and the live results will not resemble it. This is not a risk to manage; it is a certainty to avoid.
Size every one of those entries with the position size calculator and check the trade is worth taking with the risk/reward calculator before you commit.
The conditions it needs
Reviewing a chart’s completed structure
Its one unambiguous strength. Applied to history, the ZigZag renders the sequence of swings with a consistent rule and no judgement, which makes higher highs, lower lows and range boundaries immediately visible. For studying how an instrument has behaved, it is excellent.
Measuring typical leg size and duration
Because it identifies swings mechanically, you can read off how far this instrument tends to travel before reversing and how many bars that takes. That is directly useful for setting realistic targets, and it uses only fixed legs, so the repainting problem does not apply.
Labelling structure for teaching or for a trading journal
Marking up a past chart to explain what happened, or to record what you saw after a trade, is exactly the kind of retrospective work the ZigZag is suited to. There is no forward-looking claim involved, so no way to be misled.
Feeding a pattern or wave count as a drawing aid
Elliott Wave practitioners and harmonic pattern traders often use it to standardise which swings count. That is defensible as long as the count is treated as provisional until the final leg is confirmed by a subsequent reversal, which is precisely where most people stop being careful.
When it fails
- The last leg is provisional and you cannot tell when you are in it. This is the central point. The rightmost line will move if price continues, and there is no visual difference between a leg that is about to be finalised and one that is about to be redrawn. Any decision made on it is made on information that has not settled.
- Every ZigZag backtest is invalid. The MT5 strategy tester recalculates indicators across the full history, so at the moment a simulated trade is taken, the ZigZag already reflects pivots that were only knowable later. This produces results that look extraordinary and cannot be reproduced live. It is not a matter of degree; the test is measuring the wrong thing entirely.
- Hindsight charts make it look infallible. Scroll back and the ZigZag has caught the exact top and the exact bottom of every move. It always will, because it is permitted to revise until it is right. That visual impression is the reason this indicator sells so many courses, and it is the reason so many people lose money on them.
- The settings are arbitrary and fitting them is self-deception. Depth, Deviation and Backstep have no correct values. Adjust them until the chart looks clean and you have encoded the past few months of volatility into three numbers that will not describe the next few.
- It duplicates something you should learn directly. A ZigZag pivot is a swing high or swing low, which is the foundation of reading structure by eye. Depending on the indicator to see swings is a substitute for a skill rather than an addition to it, and unlike the skill, the indicator changes its mind.
- “Non-repainting ZigZag” products are misdescribed. The only way to stop a ZigZag revising is to delay each pivot until it is confirmed, which means the indicator is now lagging by exactly the amount it used to be repainting by. That is a legitimate tool, it is roughly a fractal detector, but it is not a ZigZag that has stopped repainting, and it will not produce the charts you were shown.
Markets it is most informative on
- GBP/JPY: Large, well-defined legs make retrospective structure study genuinely instructive.
- Gold (XAU/USD): Clear impulsive and corrective legs to measure when setting realistic targets.
- BTC/USD (Bitcoin): Long trending swings that illustrate structure clearly when reviewing history.
- US30 (Dow Jones): Orderly swing sequences on higher timeframes, useful for measuring typical leg size.
For different levels of experience
If you are brand new
You are going to see the ZigZag recommended a lot, usually with a screenshot of a chart where it caught every single top and bottom. Please read this section before you believe that screenshot.
The ZigZag is allowed to change the last line it drew. If it marks today’s high as a turning point and price goes higher tomorrow, it deletes that mark and moves it to tomorrow. It keeps doing that until price finally turns. So when you look back at old charts it is always right, because it was permitted to keep correcting itself until it was.
That means you cannot use it to enter trades. The line you would be acting on is exactly the line that is still allowed to move. This is not a bad version of the indicator or a setting you have got wrong; it is what the ZigZag is.
What you can do with it, and it is worth doing: turn it on and look at the shape of the market’s past. See how the highs and lows have been arranged. See how far the market usually runs before it turns. That will teach you something real. Just take your actual trades from the price chart, not from the coloured line.
If your results are inconsistent
The intermediate version of this mistake is subtler and more expensive. You know the ZigZag repaints. You have decided to only use “confirmed” pivots, and you feel that solves it.
It does not, unless you are strict about what confirmed means. A pivot is only fixed once the next pivot has formed. Until then it is the last leg, and the last leg is provisional. In practice that means the pivot you are treating as confirmed is often the one still in play, particularly during a strong move, which is exactly when you most want to trust it.
The other thing to be honest about is your backtesting. If you have a system that uses ZigZag pivots and it tests beautifully, the test is not evidence. The strategy tester rebuilds the indicator with the whole history available, so the pivots your simulated trades saw are the final ones, not the provisional ones a live account would have seen. There is no setting, no tick model and no walk-forward arrangement that fixes this while the indicator itself is still revising. The only valid test is one where the pivot logic is replaced with something causal, and if you do that, you will usually find the result is unrecognisable.
If you are experienced
The precise objection is look-ahead bias in the indicator buffer, and it is worth stating in those terms because it generalises. The ZigZag buffer at bar N is a function of bars up to N + k, where k is unbounded and unknown at evaluation time; it depends on when the next qualifying reversal occurs. Any evaluation pipeline that reads the buffer as it stands after a full recalculation is therefore conditioning on future information, and the bias is not small: it is concentrated exactly at turning points, which is where the signal is supposed to live. The resulting equity curves are not merely optimistic, they are structurally meaningless.
The correct treatment, if you need swing structure in a model, is a causal detector with explicit latency. A k-bar fractal is the simplest: extremum confirmed k bars after the fact, never revised. Add an amplitude filter (minimum excursion since the previous opposite pivot, ideally scaled by ATR) and you have most of what the ZigZag’s Deviation parameter was reaching for, with the latency made explicit and budgetable instead of hidden. Every subsequent statistic then has a defensible timestamp.
Where the ZigZag remains legitimate is in offline analysis: labelling regimes, generating training targets for supervised learning, or measuring the empirical distribution of leg magnitudes and durations. Using a forward-looking labeller to define what you are trying to predict is entirely correct. Using it to define the features you predict from is the error, and the two get conflated constantly. Keep the boundary explicit and the tool is genuinely useful on the correct side of it.
Risk management for this strategy
The financial risk from the ZigZag is unusual because it does not come from the market. It comes from acting on a chart that was not the chart you would have seen at the time.
Concretely: a trader sees the ZigZag mark what appears to be a completed swing low, buys, and the ZigZag then deletes that pivot and redraws lower as price falls. The reason for the trade did not merely fail: it retroactively ceased to exist. This makes disciplined stop placement unusually important, because the normal instinct of “the setup is still valid” has nothing to attach to. There is no fixed level to defend, because the level moved.
The larger risk is capital committed to a system built on invalid testing. A ZigZag-based expert advisor or course strategy will have been demonstrated on results that cannot occur live, and the discrepancy is not marginal. Before funding anything that uses ZigZag pivots, replace them with a causal swing detector and retest. If the strategy still works, you did not need the ZigZag. If it does not, you have just saved the account. Nothing in the position sizing will protect you from a system whose premise is unavailable in real time.
Where Market Structure Pro fits
The ZigZag is the clearest illustration on this site of why non-repainting matters, and it is worth stating the contrast directly.
A repainting indicator produces a chart in which the past is continuously improved. That is comfortable to look at and impossible to review honestly, because you can never establish what you actually saw at the moment you decided. Market Structure Pro is built the other way round: its state locks on the closed bar and does not change afterwards. The TRADE, TRANSITION or NO TRADE verdict displayed when you took the trade is the same verdict displayed when you review it a month later, along with the confidence percentage, the A/B/C grade and the plain-English explanation of what was supporting or limiting it.
That is not a marketing distinction, it is the difference between having a record and having an illusion. If a decision was poor, a non-repainting record lets you find out why. If the tool was wrong, you can see that too, MSP is decision support and it guarantees nothing. What it will not do is quietly redraw the evidence so that everything appears to have been obvious.
If you want the thing the ZigZag appeared to offer, a clear read on whether the market’s structure is trending or turning, that is precisely what MSP’s fused verdict and dedicated chop filter are built to deliver, on the closed bar, in a form you can hold it to afterwards.
One verdict with a confidence score, an A/B/C grade and a plain-English reason. Non-repainting, on every MT5 instrument and timeframe.
Stop guessing whether the setup is valid
Market Structure Pro reads structure, trend, momentum, levels, volatility, volume and session in one pass and gives you a single answer with the reasoning attached. Free 7-day trial, no card required.
Start free trialFrequently asked questions
Does the ZigZag indicator repaint?
Yes, and it does so by design rather than as a fault. The most recent leg is provisional and will be redrawn if price continues in the same direction, because the indicator moves its pivot to whatever the new extreme is. Only once the next pivot has formed does the previous one become fixed.
Can you use the ZigZag indicator for entries?
No. The part of the indicator you would be acting on is the last leg, and the last leg is exactly the part that is still allowed to change. By the time a pivot is genuinely fixed, the move it marked has already happened. Entries need to come from something that does not revise.
Why do ZigZag backtests look so good?
Because the strategy tester recalculates the indicator over the full price history, so the pivots present at the moment of each simulated trade are the final ones rather than the provisional ones a live account would have seen. The test is effectively trading with knowledge of the future, which is why the results cannot be reproduced.
Is there a ZigZag that does not repaint?
Not in any meaningful sense. The only way to stop the pivots revising is to delay confirming them until a reversal has occurred, which converts the repainting into an equivalent amount of lag. That is a perfectly usable tool, and it is essentially a fractal detector, but it will not produce the charts that non-repainting ZigZags are usually advertised with.
What is the ZigZag indicator actually good for?
Looking at completed structure. Applied to history it marks swing highs and lows with a consistent rule, which makes the sequence of higher highs and lower lows immediately visible and lets you measure how far this instrument typically travels before reversing. It is a drawing and measurement aid, not an analysis tool.
What do Depth, Deviation and Backstep do?
Depth sets the minimum number of bars the indicator looks back to find an extreme, Deviation sets how far price must reverse before a new pivot counts, and Backstep sets the minimum number of bars between two consecutive pivots. Raising all three gives fewer, larger swings; lowering them gives more, smaller ones.
Is the ZigZag indicator included in MetaTrader 5?
It is bundled, but not with the standard indicators. Rather than appearing under Insert and then Indicators, it lives in the Navigator panel under Indicators, then Examples. Drag it onto a chart from there. It is supplied as a code example, which is a reasonable indication of how it was intended to be used.
Can the ZigZag be used for Elliott Wave or harmonic patterns?
It is commonly used to standardise which swings count in a wave count or pattern, and that is defensible for analysing completed structure. The problem arises when the count depends on the final leg, because that leg can still be redrawn, meaning the pattern you believe you have identified may not exist yet.
Related reading
- Fractals: The causal alternative: it lags by two bars instead of revising, and never changes once confirmed.
- Market Structure Explained: The skill the ZigZag substitutes for: learn to read swings directly.
- Support and Resistance: Where fixed, completed ZigZag pivots do genuinely mark useful levels.
- Install Market Structure Pro: A non-repainting alternative: the verdict locks on the closed bar and does not change.