Skip to content

Free MT5 indicator

Market Structure BOS & CHoCH

Labels swing highs and lows as HH, HL, LH or LL and draws Break of Structure and Change of Character lines on candle closes.

Smart moneyv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Non-repainting signals Alerts

What it does

FXP Market Structure maps the swing structure of any chart. Every confirmed swing high is labelled HH (higher high) or LH (lower high), every swing low HL (higher low) or LL (lower low), and every time a candle closes through the most recent swing the indicator draws a horizontal line from that swing to the breaking candle, tagged BOS or CHoCH.

It is a reading aid for traders who think in terms of trend legs, pullbacks and breaks rather than oscillator values.

How it works

  1. A swing high is a candle whose high is above the highs of the previous N candles (left bars) and not exceeded by the next M candles (right bars). Swing lows are the mirror image. A swing is only confirmed once the M right-hand candles have closed, so the label is placed M bars after the actual turning point.
  2. Each new swing high is compared with the previous swing high: higher gives HH, lower gives LH. Swing lows are compared the same way to give HL or LL.
  3. The indicator tracks the latest unbroken swing high and swing low. When a closed candle finishes above the swing high, structure has broken to the upside; below the swing low, to the downside. Wicks alone never count.
  4. If the break is in the same direction as the previous break, it is a Break of Structure (BOS, dashed line). If it is the first break against the previous direction, it is a Change of Character (CHoCH, solid line), and the internal trend state flips.
  5. Only closed candles are processed, and only new candles are evaluated on each update, so drawn lines do not move once placed.

How to use it

Copy the .ex5 file into your MQL5/Indicators folder (File, Open Data Folder in MetaTrader 5) and attach it to a chart.

In an uptrend you expect a sequence of HH and HL labels with bullish BOS lines. A bearish CHoCH after that sequence is the first sign that sellers have taken out a protected low; many traders treat it as a warning rather than an entry, and wait for a lower high to form before considering shorts. Combining structure with support and resistance zones or a higher-timeframe bias usually gives a clearer picture than the breaks alone.

Smaller pivot lengths (2 to 3) show internal structure on intraday charts; larger values (8 to 15) show the major swings. A common approach is to read the H4 structure for direction and the M15 structure for timing.

Settings

InputDefaultWhat it changes
Bars left of a swing pivot5Candles before the pivot that must be lower (highs) or higher (lows).
Bars right of a swing pivot5Confirmation delay; larger values mean fewer, later swings.
History bars to analyse1500How far back the structure is calculated.
Show HH/HL/LH/LL labelstrueToggles the swing labels.
Show BOS linestrueToggles continuation breaks.
Show CHoCH linestrueToggles reversal breaks.
Bullish / bearish break colorblue / redLine and text colors.
Alert on new BOS/CHoCHfalseAlert once per bar when the last closed candle breaks structure.
Also send push notificationfalseSends the same message to the MetaTrader mobile app.

Limitations

  • Swings are confirmed late by design: with 5 right bars, a swing is known only five candles after it happened. This removes repainting but adds lag.
  • The labels depend entirely on the pivot length. Two traders with different settings will see different structure on the same chart.
  • In tight ranges price can produce alternating BOS and CHoCH lines that carry little meaning.
  • A structure break is a description of what price did, not a forecast. Breaks fail regularly, so always define your risk with a stop-loss. Trading involves substantial risk of loss.

Key inputs

Key inputs of Market Structure BOS & CHoCH
InputDefaultDescription
Bars left of a swing pivot5How many earlier candles must have lower highs (or higher lows) than the pivot.
Bars right of a swing pivot (confirmation delay)5How many later candles are needed to confirm a swing. Labels appear this many bars late.
History bars to analyse1500Limits how far back structure is drawn.
Show BOS linestrueDraws dashed lines where price closed through the last swing in the trend direction.
Show CHoCH linestrueDraws solid lines where price closed through a swing against the prior trend.
Alert on new BOS/CHoCH (once per bar)falsePop-up alert when the last closed candle breaks structure.

Educational tools, not advice. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 indicators