ForexBestRobots.comCompare EAs →
EN

ZigZag · Market structure

ZigZag in MT4: Depth, Deviation, Backstep and Repainting

Explore ZigZag on real GBP/USD H1 candles. Compare MT4 parameter meanings, watch a historical endpoint move, and separate available information from hindsight.

Real GBP/USD H1 through 2024-01-05 06:00 UTC. Settings 12 / 5 / 3 and Point = 0.00001. The latest low is 1.267200; no later candle is included.
Real GBP/USD H1 through 2024-01-05 06:00 UTC. Settings 12 / 5 / 3 and Point = 0.00001. The latest low is 1.267200; no later candle is included.

ZigZag makes a complicated price path easier to inspect by connecting selected highs and lows. A clean historical line can hide when each endpoint first appeared and how it changed. This guide follows real GBP/USD H1 observations, one completed interval at a time, so those changes stay visible.

1. Read the drawing before treating it as a signal

The blue path connects vertices produced by the selected settings at the displayed information cutoff. Candles after that cutoff are hidden. The most recent vertex is highlighted in gold; gold identifies the latest endpoint, not a confirmed trade setup.

Our example reproduces the full-initialization logic of the historical MT4 ZigZag listing posted on 18 December 2014. It is an independently written educational replay. The current vendor download and a running broker terminal were not verified as identical. Compare your own indicator version before transferring these details.

Real GBP/USD H1 through 2024-01-05 06:00 UTC. Settings 12 / 5 / 3 and Point = 0.00001. The latest low is 1.267200; no later candle is included.
Real GBP/USD H1 through 2024-01-05 06:00 UTC. Settings 12 / 5 / 3 and Point = 0.00001. The latest low is 1.267200; no later candle is included.

2. Depth is a window of recorded bars

For Depth = 12, a candidate is evaluated against the current processed bar and eleven older recorded bars. The first eleven bars supply initial history; they are not processed as candidate centers. Missing clock hours are not filled, so twelve recorded bars can span more than twelve clock hours.

The comparison chart keeps Deviation = 5, Backstep = 3 and Point = 0.00001 fixed, then compares Depth = 6 with Depth = 24 at the same cutoff. The different paths are measurements under different definitions. A smoother line does not demonstrate a better trading rule.

Same cutoff, different declared settings
ComparisonDepthDeviationBackstepPointVertices at cutoff
Available path6530.000018
Comparison path24530.000012
Real GBP/USD H1 through 2024-01-05 09:00 UTC. Blue uses Depth = 6 and orange dashes use Depth = 24; Deviation = 5, Backstep = 3 and Point = 0.00001 remain fixed. Both paths use only observations available at that cutoff.
Real GBP/USD H1 through 2024-01-05 09:00 UTC. Blue uses Depth = 6 and orange dashes use Depth = 24; Deviation = 5, Backstep = 3 and Point = 0.00001 remain fixed. Both paths use only observations available at that cutoff.

3. Translate Deviation through Point before interpreting it

The selected historical implementation applies Deviation × Point inside its candidate processing. With the declared Point = 0.00001, Deviation = 5 corresponds to 0.00005 USD per GBP, or 0.5 pip. With Point = 0.0001, the same input corresponds to 5 pips. It is not a percentage input.

The saved quotes have four decimal places; choosing a five-digit Point assumption does not create finer observations. In this dataset, changing Deviation between the offered values can leave the path unchanged. The output reports the actual difference from the comparison settings. Do not describe this input as a guaranteed minimum distance between final alternating vertices.

Point = 0.00001
Deviation × Point = 5 × 0.00001 = 0.00005
1 pip = 0.0001 USD/GBP
0.00005 / 0.0001 = 0.5 pip

4. Backstep changes candidate pruning

Backstep controls the recent recorded bars searched when an inferior candidate of the same type is removed. It is not a promise that every pair of opposite final vertices will be at least that many bars apart. The selected settings require Backstep < Depth.

At the comparison cutoff, Backstep = 1 and Backstep = 5 produce different paths with the other inputs fixed. The orange dashed path uses the comparison settings. Inspect both paths and their vertex tables; this shows an implementation effect, not evidence that one setting predicts the next move.

Same cutoff, different declared settings
ComparisonDepthDeviationBackstepPointVertices at cutoff
Available path12510.000012
Comparison path12550.000014
Real GBP/USD H1 through 2024-01-03 20:00 UTC. Blue uses Backstep = 1 and orange dashes use Backstep = 5; Depth = 12, Deviation = 5 and Point = 0.00001 remain fixed.
Real GBP/USD H1 through 2024-01-03 20:00 UTC. Blue uses Backstep = 1 and orange dashes use Backstep = 5; Depth = 12, Deviation = 5 and Point = 0.00001 remain fixed.

5. Watch the last endpoint move

At 2024-01-05 06:00 UTC, the latest selected low is 1.267200 on the candle starting 2024-01-05 05:00 UTC. At 2024-01-05 07:00 UTC, a later, lower endpoint appears at 1.266300 on 2024-01-05 06:00 UTC. The earlier low is removed from the recalculated path.

Use the “Before endpoint moves” example, then advance one completed hour. The comparison output lists removed and added vertices against the preceding snapshot. A bar’s timestamp identifies where its price was recorded; it does not prove that the endpoint would remain unchanged afterward.

Endpoint replacement in two available snapshots
Snapshot known UTCEndpoint bar start UTCTypePrice · USD per GBP
2024-01-05 06:002024-01-05 05:00Low1.267200
2024-01-05 07:002024-01-05 06:00Low1.266300
Real GBP/USD H1 through 2024-01-05 07:00 UTC. The new low is 1.266300. The dashed orange comparison is the preceding snapshot extended only to its last known vertex; it is not a second live signal.
Real GBP/USD H1 through 2024-01-05 07:00 UTC. The new low is 1.266300. The dashed orange comparison is the preceding snapshot extended only to its last known vertex; it is not a second live signal.

6. Keep the month-final line out of an earlier decision

The hindsight illustration takes the month-final calculation and shows only its vertices inside the earlier chart window. Its dashed violet path still depends on later observations even though the later candles are hidden. It is explicitly labelled as hindsight.

The blue path is calculated only from the data available at that earlier cutoff. A missing or relocated vertex in the month-final drawing cannot be used to rewrite what an earlier decision-maker saw. This comparison explains look-ahead bias; it does not estimate a strategy’s return.

Real GBP/USD H1 at 2024-01-05 06:00 UTC. Blue is the available prefix calculation. Violet dashes are vertices from the month-final calculation, cropped to the earlier window. That dashed path uses future information and is labelled as hindsight.
Real GBP/USD H1 at 2024-01-05 06:00 UTC. Blue is the available prefix calculation. Violet dashes are vertices from the month-final calculation, cropped to the earlier window. That dashed path uses future information and is labelled as hindsight.

7. Use ZigZag to organize a repeatable review

Record the feed, timeframe, indicator implementation, loaded-history start, settings and the observation cutoff before comparing swings. Keep a saved snapshot if you need to know what the indicator displayed earlier. Moving an anchor after seeing the next price move changes the question being tested.

For a Fibonacci measurement, distinguish a provisional ZigZag endpoint from an anchor fixed by a separate availability rule. The previous guide uses its own strict two-left/two-right pivot convention. That convention is not silently added to ZigZag here. Neither a connected leg nor a Fibonacci touch supplies an entry rule by itself.

8. Understand what these closed-hour snapshots leave out

The replay starts from the same first observed hour and clears its buffers at every cutoff. It uses completed OHLC intervals and exact integer prices. It does not recreate the terminal’s incremental prev_calculated branch, a still-forming candle, every tick path, or platform floating-point details. Native-terminal parity has not been tested.

January contains 530 observed hourly intervals, including 4 with fewer than 60 source minute records and 4 gaps between recorded hours. The feed and grouping convention remain visible in the downloads. The figures contain real quote OHLC; there are no invented replacement candles, trade fills, win rates or profit claims.

9. Change the cutoff first, then compare one setting

Choose a completed H1 interval to change what information is available. Previous and next move by one recorded interval, so check the UTC cutoff around gaps. Then change Depth, Deviation, Backstep or the declared Point assumption. Each output says which settings and which time produced the path.

The optional comparison mode adds either a preceding snapshot, a different parameter set at the same cutoff, or the explicitly labelled month-final hindsight path. The vertex table gives each bar time, price and type. Static charts and CSV tables remain available without JavaScript.

Inspect the path available at a completed hour

First change the information cutoff. Then change one setting. The latest endpoint and the vertex differences explain what changed; no order is placed.

Frequently asked questions

Does ZigZag repaint?

The example shows a latest endpoint removed and replaced after a later completed hour. A finished historical drawing does not preserve every intermediate state. The exact recalculation behavior also depends on the indicator version and execution method.

Does Depth = 12 require twelve future candles to confirm a pivot?

No such future-confirmation rule is used here. Depth defines a window containing the current processed bar and older recorded bars. A separate pivot-confirmation rule must be declared if a strategy needs one.

Is Deviation = 5 the same as 5 pips?

Only when Point and the quote convention make it so. Under the five-digit assumption used here, 5 × 0.00001 = 0.00005, or 0.5 pip. A four-digit Point of 0.0001 makes the same input 5 pips.

Does Backstep define a minimum distance between opposite vertices?

That interpretation is not used for this historical listing. Backstep participates in removing inferior same-type candidate points. Read the resulting vertices rather than assuming a minimum spacing between all opposite endpoints.

Why can my MT4 chart look different?

Compare source version, quote feed, history length, Point, timeframe, current-bar state and full versus incremental recalculation. This guide tests a declared historical full-recalculation port, not every current terminal installation.

Can these charts prove a profitable ZigZag strategy?

No trades are simulated. A strategy would need prospective entry and exit rules, exact information availability, costs and a separate test. Selecting clear historical swings is useful for explanation but cannot establish profitability.

Data, calculation method and scope

The retained Forexite minute CSV is verified by its SHA-256 checksum before aggregation. Its source timestamps use GMT+1; this January example subtracts one hour for UTC and groups minute labels in (hour end − 1h, hour end]. Each chart labels the interval start and states when that interval has completed.

The retained source has four-decimal prices. The saved daily-archive URLs and hashes establish earlier provenance; the original daily archive bytes were not reverified in this task. The downloads include the exact hourly observations, settings, all selected snapshots and the independently written calculation code.

The implementation reference is the dated 18 December 2014 MT4 listing, not a verified checksum of the current CodeBase download. The full-initialization branch is the scope of this replay. The method and example-selection rules are frozen before the illustrations; selected changes are teaching examples, not a performance sample.

Primary references