Order Block Locator Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

An order block is the last candle against the move before price takes off. The order block locator indicator finds those candles with a simple test: did the next three bars travel at least one and a half average ranges away? If so, it outlines the candle as a box and waits. When a later bar returns into the box and closes the right way, an arrow marks the retest.

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 4: Bull OB Retest, Bear OB Retest, Swing High, Swing Low
Alerts popup, push notification, email, sound
Inputs 17

Output you can see

Outline boxes, two retest arrows and swing dots.

`BullOBColor` `clrSeaGreen` outlines bullish blocks.

`BearOBColor` `clrCrimson` outlines bearish blocks.

`Bull OB Retest` prints lime, arrow 233, under the bar.

`Bear OB Retest` prints red, arrow 234, over the bar.

`Swing High` and `Swing Low` add small orange and blue dots.

A top-left line counts the boxes and shows the current ATR.

  • Bull OB Retest: arrow, lime, width 2, arrow code 233
  • Bear OB Retest: arrow, red, width 2, arrow code 234
  • Swing High: arrow, orange, width 1, arrow code 119
  • Swing Low: arrow, dodger blue, width 1, arrow code 119
order block locator indicator: Order block boxes with bull and bear retest arrows, EURUSD H1.
Order block boxes with bull and bear retest arrows, EURUSD H1.

How the plots get their values

Block test

A bearish candle becomes a bullish block when the highest high of the next `ImpulseBars` `3` bars sits at least `ImpulseATRMult` `1.5` times the `ATRPeriod` `14` range above its low, and above its own high. Bearish blocks mirror this. Only closed bars count.

Box drawing

Each box spans the candle’s high and low and runs right to the last closed bar. `MaxOBs` `20` keeps the newest twenty, so old boxes drop off as new ones appear.

Retest arrow

Price must come back within `RetestTolerancePips` `5` pips of the box. For a bullish block, a green-bodied bar whose low touches that band gets the arrow. If a low trades ten pips under the box first, the search for that block ends.

Swing dots

A high above the two bars on each side gets an orange dot, a low below them a blue one. These pivots sit apart from the block logic and simply show structure.

Using it on a chart

Green outlines are demand, red outlines supply.

A lime arrow is a bullish bar leaving a green box.

Red arrows mark rejection from a red box.

Each block gets one arrow at most, its first retest.

Arrows sit at least five bars apart, across both sides.

Swing dots help judge whether structure agrees.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

A retest on the last closed bar raises one message, such as “OB Locator: Bull OB retest on EURUSD PERIOD_H1”. Popup and sound start on under `EnableAlerts`; push and email wait for you to switch them on.

Every Order Block Locator Indicator input

Core settings

Setting What it does Default
StructureLookback Structure lookback (bars). Recent bars rechecked on every tick, `50`. 50
ImpulseBars Impulse window after OB candle. Bars after the candle that make up the move, `3`. 3
ImpulseATRMult Impulse strength (x ATR). Move size in average ranges, `1.5`. 1.5
ATRPeriod ATR period. Average range window, `14`. 14
MaxOBs Max OBs to draw. Newest boxes kept, `20`. 20
RetestTolerancePips Retest tolerance (pips). Band around a box that counts as a touch, `5`. 5

Display settings

Setting What it does Default
ShowOrderBlocks Draw OB rectangles. Box outlines on, `true`. on
ShowSwings Mark swing pivots. Pivot dots on, `true`. on
BullOBColor (see inputs panel) sea green
BearOBColor (see inputs panel) crimson
ArrowOffsetPts Arrow offset (points). Gap between arrow and bar, `12` points. 12

Alert settings

Setting What it does Default
EnableAlerts Retest alert master switch, `true`. on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) on
SoundFile (see inputs panel) alert.wav
order block locator indicator: Inputs panel, impulse test above the box and alert settings.
Inputs panel, impulse test above the box and alert settings.

Symbols and timeframes

On EURUSD H1 from 18 to 26 August 2026, the panel counted twenty boxes, and most sat in the late-August range near price. On M15 the 1.5-range rule finds blocks every session. On H4 and D1 it finds only the larger swings.

When to distrust it

Boxes stay drawn after price breaks through them.

Neighbouring candles can both qualify as blocks.

Ranges stack many boxes in one band.

Pip tolerance is fixed, so gold needs a larger value.

Copy the compiled Order Block Locator 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 Order Block Locator Indicator: Supply and demand at BabyPips, Market liquidity on Wikipedia.

Download the Order Block Locator Indicator for MT4 and MT5

The zip holds the compiled Order Block Locator 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.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

How does ImpulseATRMult 1.5 decide a block?

It measures the move that follows the candle. The best high of the next three bars must sit at least one and a half average ranges above the candle’s low, so small drifts never become blocks.

Why does a ShowOrderBlocks box stay after a break?

Breaking a block only ends the search for its retest arrow. The outline itself stays until MaxOBs pushes it out, so read a broken box as history rather than a live zone.

What does RetestTolerancePips 5 change?

It widens each box by five pips when checking for a touch. A larger value catches near misses on volatile pairs, while a smaller one only counts bars that trade right into the block.

Why is there only one Bull OB Retest per block?

The search stops at the first qualifying bar. Later touches of the same box print nothing, which keeps the arrow tied to the first, usually cleanest, return to that block.

What does StructureLookback 50 do live?

On every new tick the indicator rechecks the last fifty or so bars. That lets a retest of an older block still print its arrow and alert without reloading the chart.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Order Block Locator Indicator as one input. Always backtest before trading live.

Category: this is part of our Smart Money collection. Browse more Smart Money for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment