Forex
+100 Assets
Content table
8 hours ago
9 Minutes read
Written by Greenup24

Gold pulls back several times during a rally. Which pullback matters to the broader move? The ZigZag indicator makes that question easier to answer by connecting selected highs and lows. The tricky part is the right edge of the chart. A turning point you see now may move after a few more candles.
This Greenup24 guide explains how ZigZag selects swings, what its MetaTrader 5 settings actually do, and how to test an idea without using information that would have been unavailable at the time.
ZigZag is a price-chart overlay that connects alternating swing highs and lows. The segment between two points is called a leg. Which price moves get a leg of their own depends on the price action and the sensitivity of the indicator.
Suppose price rises from 100 to 110, dips to 108, then climbs to 113. If the pullback from 110 to 108 fails to meet the indicator's rules for a separate swing, ZigZag may show the whole move from 100 to 113 as one rising line. The candles still show what happened within that move.
ZigZag checks candle highs and lows within a lookback window. In the MT5 example, Depth sets the size of that window, and Backstep helps remove weaker candidates of the same type from nearby earlier candles. The indicator connects selected highs and lows in alternating order. If a more extreme point of the same type qualifies, it can replace the endpoint of the latest leg.
Suppose ZigZag on the hourly XAU/USD chart connects a $2,400 low to a $2,420 high. The next segment depends on what the candles do and how the indicator is configured.
| What happens on the chart | How ZigZag may respond |
|---|---|
| Gold pulls back to $2,415. | If the indicator does not select a new swing low there, it draws no separate down leg. |
| A new qualifying high forms at $2,428. | The latest rising leg can shift its endpoint from $2,420 to $2,428. |
| Gold drops to $2,408 and the low meets the selection rules. | ZigZag can draw a down leg from $2,428 to $2,408. |
The prices illustrate how the line can change. Whether the indicator selects the $2,408 low depends on the surrounding candles and the ZigZag settings.
Repainting means fresh market data changes a point or line that the indicator already displayed. For example, a new high can move the endpoint of a rising leg to a higher price and a later candle. The last point on the MT5 ZigZag can still change after it appears on the chart.
Confirmation lag is a separate issue. A pivot may first appear several candles after the price extreme, even though the indicator draws it on the earlier candle. If a high occurred at 10:00 and only became identifiable at 10:25, a backtest that uses it for an entry at 10:00 is looking ahead. Record when the high occurred and when your rules could first use it.
A common MT5 ZigZag example uses three inputs with values of 12, 5 and 3. These are starting values for learning how the indicator behaves. Custom versions can use different inputs or interpret them differently.
| Input | Example value | What it controls |
|---|---|---|
| Depth | 12 | The size of the lookback window, in candles, used to search for local extremes. A larger window generally filters out more small swings. |
| Deviation | 5 | A price-distance input expressed in symbol points (_Point) and used when filtering candidate extremes. This implementation does not use it as a 5% reversal threshold or as a guaranteed distance between all plotted pivots. |
| Backstep | 3 | The number of prior candles checked for weaker candidates of the same type. A higher high, for instance, can remove a weaker high candidate within that window. |
If the XAU/USD point size is 0.01 in MetaTrader 5, a Deviation input of 5 corresponds to 0.05 price units in the sample's filtering calculation. Check the point size for the exact symbol you use. The final swing layout also depends on how the indicator selects highs and lows and on its other inputs.
Decide what you need to see for the symbol and timeframe you trade. Mapping the broad structure of gold on H4 calls for larger swings than studying pullbacks on M15. To learn what Depth does in MT5, compare 12 and 18 over the same stretch of candles while keeping both other inputs fixed. Check which swings disappear and whether any of them matter to your analysis.
Repeat the exercise in trending and ranging conditions. If you keep changing inputs to fit each new stretch of price history, test the same values on a period you did not use to choose them.
Compare swing highs with previous highs and swing lows with previous lows. Higher highs and higher lows describe a rising structure. Lower highs and lower lows describe a falling one. Repeated turns near two price areas may indicate a range. In an uptrend, a close below the last important swing low gives you a reason to review the structure. A subsequent lower high can provide more evidence that the trend is changing.
When several swing highs cluster near the same price, mark the area as potential resistance. A cluster of lows can mark potential support. If price breaks out, watch where the candle closes and how the market behaves if it retests the boundary. A wick through the zone followed by a close back inside can be an early sign of a failed breakout.
To measure a pullback in an upswing, draw Fibonacci retracement from the swing low to the swing high. Reverse the direction for a downswing. Levels such as 38.2% and 61.8% give you areas to watch for a price reaction. If your newest anchor moves, the retracement levels move with it. ZigZag can also help you select the points of a possible double top or triangle. Assess the pattern separately by watching price at the neckline or boundary.
Suppose the H4 chart is making higher highs and higher lows. On H1, EUR/USD breaks through resistance near 1.0850, retests it, and closes back above the zone. In this example, that close is the condition for considering an entry.
| Setup detail | Hypothetical value |
|---|---|
| Entry | 1.0855 |
| Stop below the retest low | 1.0825 |
| Target near the next resistance | 1.0915 |
| Entry-to-stop distance | 30 pips |
| Entry-to-target distance | 60 pips |
The planned reward-to-risk ratio is 2:1 before costs. When testing a setup, use executable entry and exit prices and account for spread, commissions and possible slippage. Position size depends on the risk budget, stop distance and pip value. The prices here illustrate the method.
Useful settings depend on the symbol, timeframe and purpose. For the MT5 example, start with 12, 5 and 3 and change one input at a time. For XAU/USD, check the point size of your symbol before interpreting Deviation.
Common versions can revise the newest section. Some versions marketed as non-repainting publish points later so those points can remain fixed once displayed. Check the behavior of the version you use in replay, especially if its output feeds an Expert Advisor.
It can organize short-term highs and lows. On short timeframes, confirmation lag, revisions to the newest leg and the gap between bid and ask can matter more. Test its usefulness using the prices you could have traded on your chosen timeframe.
In Elliott Wave theory, a zigzag is a corrective pattern labeled A–B–C. The ZigZag indicator plots price swings that can help you choose points to examine. A valid wave count depends on Elliott Wave rules.
ZigZag makes the sequence of highs and lows easier to read. Check what the settings measure on your platform and give the most recent leg room to change. In your tests, record the price action that triggered the decision, the level that would invalidate the setup, and when the necessary information became available.