Skip to content
All library documents

Detecting and Tracking Three-Candle Fair Value Gaps

Article MQL5 code base

Summary

The indicator identifies bullish and bearish three-candle price gaps. A bullish gap occurs when the third candle’s low is above the first candle’s high; a bearish gap occurs when its high is below the first candle’s low. It draws a zone from the gap and tracks whether later price action trades back into it, which the document calls mitigation. Unmitigated zones can extend forward, while mitigated zones freeze and change color or can be hidden.

Inputs control the minimum gap size, maximum number of displayed gaps, extension behavior, and box appearance. Detection and mitigation are checked on closed bars, so changes appear after a bar closes rather than during its formation. The document describes gaps as areas traders may watch for support or resistance, but provides no performance evidence that they predict reversals or continuation. It also notes that point-size filtering and a display cap help manage chart clutter; the indicator reads prices and does not place orders.

Key ideas

  • A bullish gap is defined by the third candle’s low exceeding the first candle’s high, with the inverse relationship defining a bearish gap.
  • The indicator tracks each zone until a later candle trades back into it.
  • Unmitigated boxes can extend to the current bar or stop after a fixed number of bars.
  • Detection and mitigation checks use closed bars, so signals do not update tick by tick.
  • Minimum-size and maximum-gap inputs help limit noise and chart clutter.

Tags

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