Market Structures + ZigZag Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

The market structures + zigzag indicator names what it finds. Every confirmed swing gets a label saying whether it beat the last one of its kind. From that sequence it separates two events: a break that continues the trend, and a break that changes its character.

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: ZigZag, BOS Buy, BOS Sell, CHoCH
Alerts popup, push notification, email, sound
Inputs 15

What the Market Structures + ZigZag Indicator draws on the chart

A zigzag section plus three marks.

`ZigZag` joins the swings in dodger blue.

`BOS Buy` uses arrow 233 in lime.

`BOS Sell` uses arrow 234 in red.

`CHoCH` uses arrow 159 in gold.

Text objects carry the HH, HL, LH and LL labels.

  • ZigZag: section, dodger blue, width 2
  • BOS Buy: arrow, lime, width 3, arrow code 233
  • BOS Sell: arrow, red, width 3, arrow code 234
  • CHoCH: arrow, gold, width 2, arrow code 159
market structures + zigzag indicator: Structure labels and a break mark on the EURUSD H1 chart.
Structure labels and a break mark on the EURUSD H1 chart.

How the Market Structures + ZigZag Indicator calculates its values

Confirming a swing

Three settings shape it. `InpDepth` `12` is the window either side, `InpDeviation` `5` the smallest move in points, and `InpBackstep` `3` the gap kept between swings.

Naming it

Each swing meets the last of its kind. A high above the previous high is a higher high. Below it, a lower high. Lows get the same treatment.

Break against change

The label sequence decides which mark prints. Breaking a high while highs were already rising continues the trend. Breaking one after a lower high instead is a change of character.

How to read the signals

Labels tell you the structure without drawing it yourself.

A run of higher highs and higher lows is an uptrend.

A break in that run is what the gold mark flags.

`InpStructureBars` `50` is how far back structure counts.

The zigzag line is the skeleton the labels sit on.

Marks arrive only after a swing confirms.

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

`InpEnableAlerts` governs the structure alerts and arrives true with `InpEnablePopup` and `InpEnableSound`, which plays `InpSoundFile`. `InpEnablePush` reaches a phone and `InpEnableEmail` posts mail, both off at the start.

Every Market Structures + ZigZag Indicator input

Core settings

Setting What it does Default
InpDepth ZigZag Depth. Bars each side of a swing, `12`. 12
InpDeviation ZigZag Deviation (points). Smallest swing move in points, `5`. 5
InpBackstep ZigZag Backstep. Bars kept between swings, `3`. 3
InpStructureBars Structure lookback (bars). History structure reads, `50`. 50

Display settings

Setting What it does Default
InpShowLabels Show HH/HL/LH/LL labels. Print the HH and LL tags, `true`. on
InpShowBOS Mark Break of Structure. Mark a break of structure, `true`. on
InpShowCHOCH Mark Change of Character. Mark a change of character, `true`. on
InpUpLabelColor (see inputs panel) lime
InpDnLabelColor (see inputs panel) tomato

Alert settings

Setting What it does Default
InpEnableAlerts Master switch, `true`. on
InpEnablePopup (see inputs panel) on
InpEnablePush (see inputs panel) off
InpEnableEmail (see inputs panel) off
InpEnableSound Cue on a mark, `true`. on
InpSoundFile Which clip plays, `”alert2.wav”`. alert2.wav
market structures + zigzag indicator: Inputs panel with InpDepth, InpStructureBars and the mark switches.
Inputs panel with InpDepth, InpStructureBars and the mark switches.

Settings that fit your chart

A twelve-bar swing window needs a chart with structure worth naming. EURUSD H1 is the reference chart. Labels there describe a real day of trade. On M5 the swings are noise. On H4 each label covers a week.

When the Market Structures + ZigZag Indicator fails

A swing needs twelve bars after it before it counts.

The newest leg can still move until those bars close.

Labels describe what happened, not what comes next.

In a range the two mark types alternate constantly.

Copy the compiled Market Structures + ZigZag 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 Market Structures + ZigZag Indicator: Market trend on Wikipedia, Technical Analysis at StockCharts ChartSchool.

Download the Market Structures + ZigZag Indicator for MT4 and MT5

The zip holds the compiled Market Structures + ZigZag 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.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What separates a BOS Buy mark from a CHoCH?

The structure it breaks into. A break of structure continues what was already happening, so highs were rising before it. A change of character breaks in the other direction, which is why it gets its own gold mark.

What do the InpShowLabels tags mean?

Each swing gets compared with the last of its kind. HH is a higher high, HL a higher low, LH a lower high and LL a lower low. The sequence of those four is the structure everything else reads.

How far back does InpStructureBars 50 count?

Fifty bars of structure, which is two days on H1. Structure older than that stops feeding the comparison, so the labels describe the current leg rather than a month of history.

Why does InpDepth 12 delay every mark?

Because a swing needs twelve bars on each side before it confirms. The high itself sits where it always did, but nothing can be labelled or marked until that right-hand window has closed.

Are results guaranteed?

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

Category: this is part of our Smart Money collection. Browse more Smart Money 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