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
- 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.
- 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.
- 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.
- 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.
- 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
| Input | Default | What it changes |
|---|---|---|
| Bars left of a swing pivot | 5 | Candles before the pivot that must be lower (highs) or higher (lows). |
| Bars right of a swing pivot | 5 | Confirmation delay; larger values mean fewer, later swings. |
| History bars to analyse | 1500 | How far back the structure is calculated. |
| Show HH/HL/LH/LL labels | true | Toggles the swing labels. |
| Show BOS lines | true | Toggles continuation breaks. |
| Show CHoCH lines | true | Toggles reversal breaks. |
| Bullish / bearish break color | blue / red | Line and text colors. |
| Alert on new BOS/CHoCH | false | Alert once per bar when the last closed candle breaks structure. |
| Also send push notification | false | Sends 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.

