Skip to content
All library documents

Detecting and Filtering Fair Value Gaps with a Modular Engine

Article MQL5 articles

Summary

The article turns the three-candle Fair Value Gap concept into a reusable detection framework. It defines bullish gaps where the later bar’s low exceeds the earlier bar’s high, and bearish gaps where the later bar’s high falls below the earlier bar’s low. It specifies each zone’s boundaries and midpoint, and explains how to scan closed bars to avoid using incomplete candles. A simple average of True Range filters out gaps smaller than a chosen volatility threshold.

The engine tracks whether a zone has been mitigated, with configurable rules based on a wick entering the gap or a close crossing its far boundary. The article separates detection, chart display, and an example execution layer, providing a structure for validating signals before integrating them into an EA. It explains the mechanics and implementation but supplies no performance study showing that gaps predict price movement. The proposed auction-market rationale and retest behavior should therefore be treated as a hypothesis to test across instruments and market conditions.

Key ideas

  • A bullish or bearish gap is identified by comparing the extremes of the first and third candles around an expansion bar.
  • The zone boundaries and midpoint can be calculated directly from those candle prices.
  • Scanning only closed candles avoids signals based on incomplete bars.
  • A Simple True Range average can filter out gaps that are small relative to recent volatility.
  • Wick-touch and close-through rules define different conditions for treating a zone as mitigated.

Tags

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