Skip to content
All library documents

An MQL5 Engine for Detecting and Tracking Order Blocks

Article MQL5 articles

Summary

The article describes an object-oriented MQL5 module for identifying bullish and bearish order-block zones. Its rules look for an opposite-color base candle followed by a larger displacement candle that closes beyond the base candle’s high or low. It also discusses confirming a market structure shift, scanning historical bars, and retiring a zone when a later closed candle mitigates it. The proposed engine is intended to be shared by a chart indicator and an Expert Advisor, with a common data structure for zone prices, direction, time, and status.

The implementation discussion covers closed-bar calculations, limiting the historical scan, dynamic object allocation, pointer checks, and cleanup. The article offers code and integration examples, not empirical tests showing that order blocks predict price movements. It presents zones as structural filters rather than guaranteed boundaries and notes that news can invalidate them; extra filters and more complete trade management would still be needed for a finished strategy.

Key ideas

  • A bullish zone is based on a bearish candle followed by upward displacement that breaks a nearby structural high, with the inverse rule for bearish zones.
  • Displacement size and a market structure break serve as validation checks for candidate zones.
  • The proposed scan uses closed bars and removes zones after a later bar mitigates their price levels.
  • A shared object-oriented engine can provide consistent zone data to an indicator and an Expert Advisor.
  • The article presents an implementation framework, not evidence that the detected zones produce profitable trades.

Tags

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