Courses Trading Tools Trading Contest Blogs
Sign Up
Strategy Development 11 min read • Published 2026-10-10

Automating Order Block Detection: Encoding Institutional Liquidity and Fair Value Gaps in MQL5

A structural, rule-based approach to programming Smart Money Concepts (SMC) into deterministic algorithms that run without subjective human discretion.

Latvian FTS Algo Team
Latvian FTS Algo Team
Algo Trading Systems Team
Tweet

De-Mystifying "Smart Money Concepts"

Much of retail "SMC" trading is shrouded in esoteric terminology. In computational reality, an "Order Block" is simply a price region where substantial institutional limit liquidity was absorbed prior to an aggressive directional momentum displacement.

The Four Algorithmic Rules for Valid Order Blocks

  1. The Origin Candle: The last bearish candle prior to a directional impulse wave.
  2. The Displacement Filter: The subsequent impulse wave must break the previous Swing High with a candle body length at least 2.2× the 14-period ATR. Without displacement, no institutional volume was committed.
  3. Fair Value Gap (FVG) Confirmation: The low of candle i+2 must remain above the high of candle i, confirming an imbalance zone.
  4. Mitigation Tracking: Once price retraces and touches the upper boundary of the order block, its status transitions from Unmitigated to Mitigated, preventing duplicate re-entries.
Latvian FTS Algo Team
Latvian FTS Algo Team
Algo Trading Systems Team • Latvian FTS

Specializing in automated trading systems, MetaTrader 5 MQL5 architecture, and practical risk controls. Focused on building robust algorithmic tools that survive live market execution.

Master Algorithmic Trading with Latvian FTS

Learn how to design, backtest, and automate high-performance trading strategies with our comprehensive video curriculum and battle-tested MetaTrader 5 tools.