Skip to content
All library documents

How an MT5 Order Block Indicator Tracks Zones and Alerts

Article MQL5 code base

Summary

This document describes the architecture of an event-driven MetaTrader 5 indicator for detecting and displaying bullish and bearish order block zones. It outlines initialization, incremental historical calculations, and a rolling three-bar structure tracker that uses timestamps to keep swing references stable across reloads and timeframe changes. The indicator filters overlapping zones by comparing fair value gap sizes and deactivates the smaller block when it is nested within another.

Mitigation can be defined by candle body close beyond a zone boundary or by wick penetration. A live tick process checks price crossings and applies a bar-based cooldown to reduce repeated alerts while price remains in a zone. The rendering process draws rectangles and labels and removes expired or mitigated zones within a configured display limit. The document explains workflow and behavior but gives no performance evaluation, detection accuracy evidence, or trading results; the usefulness of its zones as signals is therefore not established.

Key ideas

  • The indicator incrementally processes price history and tracks swing structure with a rolling three-bar window.
  • Nested order block zones are filtered by comparing their associated fair value gap sizes.
  • Zones can be considered mitigated when price closes beyond a boundary or when a wick crosses it.
  • Live price crossings trigger alerts, with a bar-based cooldown to reduce duplicate notifications.
  • The document describes implementation behavior but provides no evidence that the zones predict profitable trades.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.