Discover expert developed MetaTrader tools that can complement professional solutions.
An order block on Gold (XAUUSD) or any symbol is the last opposite candle before the move that breaks structure: the last bearish candle before a close above a confirmed swing high, or the last bullish candle before a close below a confirmed swing low. That candle becomes a zone, from high to low or body only.
The leg must show a real impulse, at least one candle with a body larger than a multiple of ATR, so slow drifts do not create zones. A fresh zone is coloured, a tested zone is dimmed after price comes back into it, and the zone is removed when a candle closes through it.
Swings are confirmed only after the bars on both sides have closed, so a zone appears a few bars after the move and does not repaint. A zone shows where the move started, not where price must turn. Test it on your symbol and timeframe before you trade it.
Unique stair-step trend trading with the Stairsteps Expert Advisor. Innovative approach for consistent results. Learn more.
Settings
- Swing length: bars on each side that confirm a swing high or low. Default 5.
- Impulse filter: the largest body in the leg must be at least this many ATR. Default 1.0. 0 turns it off.
- ATR period: default 14.
- Zone drawn from the candle: full candle (high to low) or body only.
- Bars to scan: history used on load. Default 1500.
- Show bullish / bearish, maximum live zones per side, keep broken zones and the four colours.
- Alerts: new order block and first return of price to a fresh zone, by popup, push and sound.
- Object prefix: change it to run two copies on one chart, for example two swing lengths.
What it needs
Any symbol, any timeframe, any broker. It only draws rectangles, it never trades.
Make it yours
Compare the zones on XAUUSD, EURUSD, GBPUSD, US30 and NAS100, on M15 and H1 for intraday and H4 for swing trading. A smaller swing length gives more zones, a larger one keeps only the main legs. Order blocks are a core piece of Smart Money Concepts, so they read well next to a BOS and CHoCH tool and a fair value gap tool. XP_CheckBreak finds the zone and XP_UpdateZones tracks it, both ready to reuse in an EA that waits for the first return to a fresh zone.
About this code
Open source. Use it as it is, adapt it, build your own version on top of it.
New versions and new tools are announced first on my MQL5 channel: https://www.mql5.com/en/channels/xander
Questions, suggestions and your own backtests are welcome in the Xander Lab group: https://www.mql5.com/en/messages/02eec85e4364dd01
More tools on my profile: https://www.mql5.com/en/users/09151993a
Provided as is, use at your own risk.
Related
- Smart Money Concepts BOS CHoCH
- Supply Demand Zones
- Candle Timer Countdown
Changelog
- v1.0 - 2026-11-02 - Initial release
Level up your trading with professional RobotFX expert advisors and indicators. Visit robotfx.org for proven MT4/MT5 tools.
79271