Skip to content

Free MT5 indicator

Order Blocks

Draws bullish and bearish order blocks as rectangles: the last opposite candle before a move that breaks swing structure.

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

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

  1. Swing highs and lows are confirmed with the pivot length you choose (a high above the N candles on each side).
  2. 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.
  3. 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.
  4. Bearish blocks use the same logic in reverse: highest high, last bullish candle, block from its high to its low.
  5. 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).
  6. 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

InputDefaultWhat it changes
Swing pivot length5Bigger values mean fewer, more significant blocks.
Min displacement candle body (x ATR)1.0Strength required for the move away from the block. 0 disables it.
ATR period14Volatility reference for the filter.
Use candle body instead of full rangefalseThinner blocks based on open and close.
History bars to analyse2000Look-back for drawing.
Block is mitigated whenClose beyond far edgeTouch, midpoint or close-through rule.
Mitigated blocksKeep as greyGrey out or delete finished blocks.
Max active blocks per side5Cap on live blocks.
Max grey blocks kept10Cap on finished blocks.
Extend active blocks right by N bars10Projection to the right of the last candle.
Alert on new block / mitigationfalseOne 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.

Key inputs

Key inputs of Order Blocks
InputDefaultDescription
Swing pivot length (bars each side)5Defines the swing highs and lows whose break creates a block.
Min displacement candle body (x ATR, 0 = off)1.0The move away from the block must contain a candle body at least this large.
Use candle body instead of full rangefalseDraws the block from open to close instead of high to low.
Block is mitigated whenCandle closes beyond the far edgeRule that ends a block: touch, midpoint, or close beyond the far edge.
Mitigated blocksKeep as grey rectangleGrey out finished blocks or delete them.
Max active blocks per side5Oldest active blocks are removed once this count is exceeded.

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