Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

Fair Value Gaps (FVG) - unfilled imbalance zones with fill tracking and alerts - indicator for MetaTrader 5

Muhammad Muqeem Korejo
Muhammad Muqeem Korejo
Hi, I'm Muhammad Muqeem Korejo, an MQL4/MQL5 developer from Pakistan with 1.5 years of trading experience.
I build and fix trading tools for MetaTrader 4 and MetaTrader 5:
• Expert Advisors (EAs) built from your strategy rules
• Custom indicators, alerts and on-chart panels
Views:
83
Rating:
(1)
Published:
FVGZones.mq5 (16.49 KB) view
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

A fair value gap (FVG, also called an imbalance) is a three-candle pattern where price moved so fast that the wicks of candle 1 and candle 3 do not overlap:

  • Bullish FVG: the low of candle 3 is above the high of candle 1.
  • Bearish FVG: the high of candle 3 is below the low of candle 1.

Price often comes back to such a gap later. This indicator shows the gaps that are still open, so you can see at a glance where those zones are.

FVG zones on XAUUSD M15: open bullish gaps green, bearish gaps red, filled gaps grey

What it shows

  • Every open gap as a box from candle 2 to the right, green for bullish, red for bearish.
  • The 50 % line of each gap (often called consequent encroachment).
  • How much of a gap price has filled since it formed. When the gap is filled (100 % by default, or the percent you set, for example 50 %), its box ends at the candle that filled it.
  • Optionally the filled gaps as grey boxes, so you can see how price reacted to them.

How it works

  • Gaps are found on closed candles only, so a gap never appears or disappears afterwards (no repaint).
  • Small gaps can be skipped: minimum size as a part of ATR(14) (default 0.25 x ATR) or in points.
  • To keep the chart clean only the newest open gaps are drawn (default 10 per direction).
  • The calculation is incremental: after the first run only the new candle is processed.

Inputs

  • Bars to scan (default 1500)
  • Minimum gap size, x ATR(14) / in points
  • A gap counts as filled at this percent (default 100)
  • Unfilled gaps shown per direction; keep filled gaps as boxes; filled gaps shown
  • Draw the 50 % line; colours
  • Alerts: on a new gap, when price comes back into a gap; push notification and e-mail

Buffers for Expert Advisors (iCustom, not drawn)

  • 0 / 1: top / bottom of the newest unfilled bullish gap
  • 2 / 3: top / bottom of the newest unfilled bearish gap
  • EMPTY_VALUE when there is none

Example: double top[]; CopyBuffer(handle, 0, 1, 1, top); gives the top of the newest open bullish gap on the last closed candle.

Good to know

  • It works on any symbol and time frame.
  • The indicator only draws and calculates; it never trades.
GDS Renko Liquidity Sweep Lab GDS Renko Liquidity Sweep Lab

GDS Renko Liquidity Sweep Lab is a free educational indicator for studying what happens after price crosses a confirmed Renko swing level.

Enhanced Spread Monitor Enhanced Spread Monitor

Spread Monitor is a simple information indicator for MetaTrader 5. It displays the current spread in pips in the form of a compact graphical panel with colour-coded indicators and a level bar.

Market Structure BOS and CHoCH - swing points HH / HL / LH / LL, no repaint, alerts Market Structure BOS and CHoCH - swing points HH / HL / LH / LL, no repaint, alerts

Market structure in the way of Smart Money Concepts: swing highs and lows with HH / HL / LH / LL labels, BOS (break of structure) and CHoCH (change of character) lines. Swings count only after their right candles close, so nothing repaints. Alerts and a trend buffer for EAs.

MACD Signals MACD Signals

Indicator edition for new platform.