What it does
FXP Order Blocks marks the candle where a decisive move started. When price closes through a recent swing high, the indicator finds the last bearish candle at the bottom of that move and draws it as a bullish order block. When price closes through a swing low, the last bullish candle at the top of the move becomes a bearish order block.
Active blocks extend to the right until they are mitigated. Mitigated blocks are either greyed out and frozen at the bar that ended them, or deleted, and the number of blocks on the chart is capped so the chart stays readable.
How it works
- Swing highs and lows are confirmed with the pivot length you choose (a high above the N candles on each side).
- A bullish trigger is a closed candle that finishes above the latest unbroken swing high. The indicator looks between that swing high and the breaking candle, finds the lowest low, and takes the last bearish candle at or just before that low (searching up to 10 bars back). That candle's high and low form the block.
- Optional displacement filter: between the low and the breaking candle there must be at least one candle whose body is at least X times the 14-period ATR. This removes blocks created by slow drifts.
- Bearish blocks use the same logic in reverse: highest high, last bullish candle, block from its high to its low.
- On every new closed candle each active block is checked against the mitigation rule: wick touches the block, wick reaches its midpoint, or close beyond its far edge (default).
- Only closed candles are evaluated and only new bars are processed on each update.
How to use it
Copy the .ex5 file into MQL5/Indicators and attach it to a chart.
A fresh bullish block below price is an area where some traders look for long setups on a pullback, ideally in the direction of the higher-timeframe trend. The first return into a block is usually watched most closely; blocks that price has already traded through several times tend to carry less weight. Combine blocks with support and resistance, a structure tool and a defined risk-reward ratio rather than using them alone.
H1 and H4 blocks are a common starting point for forex and gold. On M5 and below, raise the displacement filter to cut noise.
Settings
| Input | Default | What it changes |
|---|---|---|
| Swing pivot length | 5 | Bigger values mean fewer, more significant blocks. |
| Min displacement candle body (x ATR) | 1.0 | Strength required for the move away from the block. 0 disables it. |
| ATR period | 14 | Volatility reference for the filter. |
| Use candle body instead of full range | false | Thinner blocks based on open and close. |
| History bars to analyse | 2000 | Look-back for drawing. |
| Block is mitigated when | Close beyond far edge | Touch, midpoint or close-through rule. |
| Mitigated blocks | Keep as grey | Grey out or delete finished blocks. |
| Max active blocks per side | 5 | Cap on live blocks. |
| Max grey blocks kept | 10 | Cap on finished blocks. |
| Extend active blocks right by N bars | 10 | Projection to the right of the last candle. |
| Alert on new block / mitigation | false | One alert per bar. |
Limitations
- An order block is a price area defined after the fact. There is no guarantee that orders are actually resting there, and price often slices through blocks.
- The block is only created once structure breaks, so it appears some bars after the candle it marks.
- Results depend heavily on pivot length, the displacement filter and the mitigation rule.
- Gaps and thin liquidity (weekend opens, news spikes) can create very large blocks. Always size positions with a position size calculator and use a stop-loss. Trading involves substantial risk of loss.

