Fair Value Gap Fill Time Study
"Fair value gaps always get filled" is repeated often and measured rarely. This script uses the standard 3-candle definition: for bars 1, 2 and 3 in sequence, a bullish gap exists when bar 1's high sits below bar 3's low (the gap zone is that space, with bar 2 the impulse candle in between); a bearish gap is the mirror case, bar 1's low above bar 3's high. Every qualifying triplet in the loaded history is recorded, along with its width in pips and the server-hour session it formed in. "Filled" means any later bar's range overlaps the gap zone at all, not that price closes past the far side - a single wick reaching back into the gap is the fill event most traders who watch fair value gaps are actually referring to. Time-to-fill is counted in bars from the gap's formation to that first overlapping bar; a gap that never gets revisited within the lookahead window is reported as unfilled rather than given an artificial fill time. Gaps are bucketed by width - small, medium, large, using two pip thresholds - and by session - Asian, London, New York, using two configurable server-hour boundaries - producing a 3x3 fill-rate table. This lets "do small gaps in the London session fill faster than large gaps overnight" be answered from one run instead of guessed at. Notes and limitations - Session boundaries are plain server-hour buckets, not true market-open calendars with holidays or DST transitions - close enough for a base-rate study, not a substitute for a full session calendar. - A gap's own three candles are excluded from its own fill search; only bars strictly after the gap-completing candle can fill it. - This is a descriptive study, not a trading signal. It does not account for spread or slippage, and buckets with a small gap count should be treated with appropriate scepticism before trusting the fill percentage. - Overlapping gaps (a new gap forming while an older one is still unfilled) are each tracked independently; the script does not merge or net them.
Script · MT5 · v1.0 · Free
About Fair Value Gap Fill Time Study
Fair Value Gap Fill Time Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 10 settings, such as Symbol, Timeframe and Max bars. MQL source code included.
Files in the download: FvgFillTimeStudy.ex5, FvgFillTimeStudy.mq5, FvgFillTimeStudy.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Timeframe | PERIOD_H1 | Timeframe to study |
| Max bars | 6000 | Most recent bars to include |
| Small max pips | 6.0 | Gaps at or below this width are "small" |
| Medium max pips | 15.0 | Gaps at or below this width (and above small) are "medium"; wider is "large" |
| Max lookahead bars | 200 | Bars searched forward for the fill; unfilled if none found |
| London start hour | 7 | Server hour the London session bucket begins (0-23) |
| New york start hour | 13 | Server hour the New York session bucket begins (0-23) |
| Save csv | true | Write every gap event to a CSV file |
| Delimiter | DelimiterComma | CSV column separator |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Smart Money (SMC / ICT) · Trading Sessions · Alerts · MT5 Script · MQL5 Source Code