Order blocks often sit right at the swing that started a move. The pivot order block indicator waits for a swing pivot with five bars on each side, finds the last opposite candle leading into it, and boxes that candle as a block. When price later returns to the box and holds, it marks a 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: Pivot High, Pivot Low, OB Buy, OB Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 13 |
Which plots exist
Boxes, pivot dots and two marks on price.
`Pivot High` dots orange red above swing highs.
`Pivot Low` dots deep sky blue below swing lows.
`InpBullOBColor` `clrLimeGreen` outlines demand boxes.
`OB Buy` prints lime at width 3 on a retest.
`OB Sell` prints red at width 3 on a retest.
- Pivot High: arrow, orange red, width 1, arrow code 119
- Pivot Low: arrow, deep sky blue, width 1, arrow code 119
- OB Buy: arrow, lime, width 3, arrow code 233
- OB Sell: arrow, red, width 3, arrow code 234

How each value gets built
Pivots
`InpPivotLen` `5` bars on each side must stay above a low for it to count as a swing low.
Block candle
The last bearish candle leading into that low becomes a demand block. Swing highs mirror this with the last bullish candle.
Retest
A later bar whose low returns into the block, within 0.15 of a range, and closes above its bottom prints a buy. Blocks expire after `InpOBMaxAge` `100` bars.
Getting a read from it
Dots show every confirmed pivot.
Green boxes are demand, crimson boxes supply.
Lime marks sit under retests that held.
Retests only count after the pivot confirms.
Blocks drop out after a hundred bars.
Warm-up needs about fifteen bars.
Alert channels in this build: popup, push notification, email and sound.
Retests report once per closed bar through `InpEnableAlerts`. The popup and the sound playing `InpSoundFile` start switched on; mobile and email start off.
Every Pivot Order Block Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpPivotLen |
Pivot lookback (bars each side). Bars on each side of a pivot, `5`. | 5 |
InpOBMaxAge |
Max OB age in bars. Bars a block stays live, `100`. | 100 |
InpRetestATR |
Retest distance (x ATR). Retest distance in ranges, `1`. | 1 |
InpATRPeriod |
ATR period. Range window, `14`. | 14 |
Display settings
| Setting | What it does | Default |
|---|---|---|
InpShowBoxes |
Draw OB rectangles. Draw block boxes, `true`. | on |
InpBullOBColor |
Demand box colour, `clrLimeGreen`. | lime green |
InpBearOBColor |
Supply box colour, `clrCrimson`. | crimson |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpEnableAlerts |
Master alert switch, `true`. | on |
InpEnablePopup |
Popup, `true`. | on |
InpEnablePush |
(see inputs panel) | off |
InpEnableEmail |
(see inputs panel) | off |
InpEnableSound |
Sound, ships on, `true`. | on |
InpSoundFile |
(see inputs panel) | alert.wav |

Choosing well
Five-bar pivots give a few blocks a day on the hourly EURUSD screenshot. On M15 blocks crowd the chart. On H4 each block anchors a real swing.
What it misses
Blocks depend on pivots that confirm five bars late.
Many retests fail in a strong trend.
One swing can create overlapping boxes.
The sound route ships on.
Copy the compiled Pivot Order Block 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.
Related on forexmt4systems.com: Pivot Point Strategy.
Download the Pivot Order Block Indicator for MT4 and MT5
The zip holds the compiled Pivot Order Block 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.
FAQ
Which candle becomes the block at a Pivot Low?
The last bearish candle leading into the swing low, found within a few bars before it. That down candle is where sellers made their final push before the turn.
What counts as an OB Buy retest?
A later bar whose low comes back into the demand box, allowing 0.15 of a range, and closes above the box bottom. The build accepts blocks between six and one hundred bars old.
Why does InpPivotLen 5 delay the blocks?
A pivot needs five closed bars on each side before it counts. The build stores the block behind it only once the pivot confirms, so boxes appear five bars after the turn.
What does InpOBMaxAge 100 remove?
Blocks older than a hundred bars. A return to an old block no longer produces a mark, since the order flow that created it has long gone by then.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Pivot Order Block 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
- The core method is documented in Favourite-longshot bias on Wikipedia.
- Additional market context is at Quantitativeanalysis at Investopedia.
