The break of structure indicator keeps a memory. Every confirmed fractal swing goes into a list, up to `MaxSwingsToTrack` of them. When a close takes price beyond one of those stored levels, the code marks the bar and draws a line at the level that broke.
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 | 2: BoS Buy, BoS Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 15 |
What the Break of Structure Indicator draws on the chart
BoS Buy places a lime arrow on the close that cleared a stored swing high.
BoS Sell places a red arrow on the close that broke a stored swing low.
OBJ_TREND lines mark the broken levels, in `BoSLineColorBull` or `BoSLineColorBear`.
`DrawBoSLines` turns those lines off if you want the marks alone.
- BoS Buy: arrow, lime, width 2, arrow code 233
- BoS Sell: arrow, red, width 2, arrow code 234

How the Break of Structure Indicator calculates its values
Collecting the swings
A swing high needs `FractalLookback` `3` bars on each side that fail to reach it. Each confirmed swing goes into a list with its price and its bar time. Duplicate times get rejected, so one bar cannot register twice.
Testing the close against memory
For each bar the code walks the stored swing highs. A stored high older than this bar, sitting below the current close, counts as broken. The swing low test mirrors it. Comparing by time rather than index keeps the memory honest.
Capping the drawing
`MaxSwingsToTrack` `50` bounds the memory itself. `MaxBoSLines` `20` bounds how many level lines stay on the chart. Both caps exist because a long history would otherwise fill the chart with objects.
How to read the signals
A mark means price closed past a level that had already formed.
The drawn line shows exactly which swing gave way.
Several marks in a row usually mean one move clearing a cluster of old swings.
Raise `FractalLookback` to store only the larger swings.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
`EnableAlerts` starts on and `EnablePopup` carries the text. `EnablePushNotify`, `EnableEmail` and `EnableSound` begin false. `SoundFile` picks the clip. The break test reads closed bars, and the guard allows one message per bar.
Every Break of Structure Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
FractalLookback |
Fractal lookback (N bars each side). Bars each side of a fractal swing, default `3`. | 3 |
MaxSwingsToTrack |
Max swing highs/lows to remember. How many swings the memory holds, default `50`. | 50 |
MaxBoSLines |
Max BoS lines kept on chart. Cap on the break lines kept on the chart, default `20`. | 20 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPoints |
Arrow distance from bar high/low (points). Mark distance from the bar in points, default `20.0`. | 20.0 |
DrawBoSLines |
Draw HLINE at broken swing levels. Draws a line at each broken level, default `true`. | on |
BoSLineColorBull |
Colour for a bullish break line, default lime. | lime |
BoSLineColorBear |
Colour for a bearish break line, default red. | red |
BoSLineWidth |
Break line width, default `1`. | 1 |
BoSLineStyle |
Break line style, dotted by default. | STYLE_DOT |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Master switch for the structure break alerts, default `true`. | on |
EnablePopup |
Terminal dialog on a structure break, default `true`. | on |
EnablePushNotify |
Phone push on a structure break, default `false`. | off |
EnableEmail |
Mail delivery on a structure break, default `false`. | off |
EnableSound |
Sound playback on a structure break, default `false`. | off |
SoundFile |
Wav clip for the structure alert, default `alert.wav`. | alert.wav |

Settings that fit your chart
Structure breaks need swings worth breaking. EURUSD H1 is the reference chart, where `FractalLookback` at `3` picks turns lasting a few hours. On M5 the memory fills with tiny swings and marks come thick. On H4 each break clears a level that took days to form.
When the Break of Structure Indicator fails
A three-bar fractal is a small swing, so many stored levels carry little weight.
One strong move can break several stored levels and produce a run of marks.
The memory has no age limit beyond its size cap, so a very old swing still counts.
Copy the compiled Break of Structure 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 Break of Structure Indicator: Smart money index on Wikipedia, Chaikin Money Flow Cmf at StockCharts ChartSchool.
Download the Break of Structure Indicator for MT4 and MT5
The zip holds the compiled Break of Structure 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.
FAQ
What does MaxSwingsToTrack at 50 hold?
The fifty most recent confirmed swings on each side, with their prices and bar times. Once the list is full the oldest entries fall out. Raising it means older levels stay eligible for a break, which produces more marks on a long chart.
How small a swing does FractalLookback accept?
One with three bars on each side that fail to beat it. That is a small window, so plenty of minor turns qualify. Raise it to 5 or more when the memory keeps filling with levels you would not have drawn yourself.
What do the DrawBoSLines objects show?
The exact price of the swing that broke, drawn as a dotted line in the bull or bear colour. They matter because a mark alone does not tell you which level gave way. `MaxBoSLines` `20` caps how many stay on screen.
Why does MaxSwingsToTrack store times, not indexes?
So the code cannot break a level that formed after the bar being tested. Bar indexes shift as new candles arrive, while a bar time never changes. Comparing times keeps the memory correct through history rebuilds.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Break of Structure Indicator as one input. Always backtest before trading live.
Category: this is part of our Smart Money collection. Next, truly, truly, plainly, browse more Smart Money for MetaTrader, or explore every MT4 tool and MT5 tool on the site.
External references
- Learn more about the underlying method in Smart money index on Wikipedia.
- For wider market background, see Chaikin Money Flow Cmf at StockCharts ChartSchool.
