Fair value gap tmt
- 지표
- 버전: 1.0
- 활성화: 20
FVG DGT Panel [TMT] — Fair Value Gap and Inverse FVG Indicator with Live "% Left" Fill Tracking for MetaTrader 4
Version for MT4 | Non-repainting zone logic | BUY / SELL / NEUTRAL bias panel | FVG + IFVG | Optional second timeframe
1. Overview
FVG DGT Panel [TMT] is a chart-window indicator for MetaTrader 4 that finds, draws and tracks Fair Value Gaps (FVG) and Inverse Fair Value Gaps (IFVG) directly on your price chart. It is a MetaTrader 4 port of the popular "Fair Value Gaps by DGT" concept originally written for TradingView in Pine Script, rebuilt for MT4 with a compact information panel and several additions that are not part of the original script.
The idea behind a Fair Value Gap is simple. When price moves very fast in one direction, it can leave behind a small price range that was never traded back and forth properly, a pocket of imbalance between buyers and sellers. Many discretionary traders who work with price action, Smart Money Concepts (SMC), Inner Circle Trader (ICT) style concepts or plain supply and demand treat these pockets as areas where price may later return, react, or fail. This indicator automates the tedious part of that workflow: it scans the chart for those gaps, draws them as colored zones, extends them to the right while they remain valid, and removes them once they are filled.
On top of the classic FVG logic, this version adds four things that make the zones easier to read and to act on:
- A live "% left" label on every active FVG. Each zone tells you how much distance is still left before the zone counts as filled. A fresh, untouched zone shows 100% left. As price pushes into the zone, the number counts down. When it reaches 0% the zone is filled and disappears.
- Inverse FVG (IFVG) tracking with its own colors and its own text label. When a filled zone is broken by a candle close on the far side, the indicator turns it into an IFVG that is drawn in a separate color and tagged on the chart, so you can tell at a glance what is a fresh FVG and what is an inverted one.
- A compact panel in the corner of the chart that shows the current bias (BUY, SELL or NEUTRAL), the last FVG or IFVG event, how many zones are active, how far the nearest bullish and bearish zones are from price, and whether price is currently sitting inside a zone.
- Two independent FVG sources. You can run FVG #1 on the chart timeframe and FVG #2 on a different timeframe (for example M15 zones displayed on an M5 chart), each with its own colors.
2. What is a Fair Value Gap (FVG)?
A Fair Value Gap is a three-candle pattern. Take three consecutive candles and call them candle 1 (the oldest), candle 2 (the middle one) and candle 3 (the newest).
Bullish FVG. Candle 2 is a strong upward candle. The low of candle 3 is higher than the high of candle 1. The range between the high of candle 1 and the low of candle 3 is the gap. Price moved up so quickly that this range was not covered by overlapping wicks.
Bearish FVG. Candle 2 is a strong downward candle. The high of candle 3 is lower than the low of candle 1. The range between the low of candle 1 and the high of candle 3 is the gap.
Traders usually interpret these gaps in one of three ways:
- As a magnet. Price often returns to a gap later, to "rebalance" the area, before continuing in its original direction or reversing.
- As support or resistance. A bullish FVG below the current price is watched as a possible support area; a bearish FVG above price is watched as possible resistance.
- As a footprint of aggressive participation. A cluster of unfilled gaps in one direction can reflect a sustained, one-sided move.
3. What is an Inverse FVG (IFVG)?
An Inverse FVG is a Fair Value Gap that has failed and flipped its role.
A bullish FVG is normally expected to hold as support. If price trades down through the zone and then a candle closes below the bottom of that zone, the zone has not held. In the inverse-FVG view, that failed bullish gap now becomes a bearish IFVG, an area that may act as resistance if price comes back up into it.
The same works in the opposite direction. A bearish FVG that is filled and then broken by a candle closing above its top becomes a bullish IFVG, an area that may act as support.
In short:
- Bullish FVG: filled, then a candle closes below the zone, result: Bearish IFVG (resistance).
- Bearish FVG: filled, then a candle closes above the zone, result: Bullish IFVG (support).
4. Feature Summary
- Automatic bullish and bearish FVG detection with a strict three-candle rule, drawn as zones that extend to the right until filled.
- Four fill methods: Any Touch, Midpoint, Wick Sweep and Body Beyond, used consistently for zone removal, IFVG creation and the "% left" value.
- Live "% left" label on every active FVG, with adjustable font size and colors.
- Inverse FVG tracking with its own colors and an "IFVG (S)" or "IFVG (R)" text label.
- Information panel with BUY / SELL / NEUTRAL bias, last event, zone counts, nearest-zone distance and price location.
- Optional second FVG timeframe with separate colors.
- Zones are built from closed candles. A replay of past bars on load shows recent zones immediately, and all objects are removed cleanly with the indicator.
5. How the Indicator Detects an FVG (Exact Rules)
The detection follows the logic of the original Pine Script. For the source timeframe in use, the indicator looks at the three most recently closed candles of that timeframe: the newest one (candle 3), the middle one (candle 2) and the oldest one (candle 1).
Bullish FVG is created when all of these are true: - The low of the newest candle is above the high of the oldest candle. - The close of the middle candle is above the high of the oldest candle. - There is no earlier gap that already "prevents" this one, meaning the newest candle's low is not simply above the middle candle's high, and the middle candle's low is not simply above the oldest candle's high. This condition keeps the detection aligned with the Pine logic and avoids stacking an extra zone on top of a larger move that already left its own gap.
The zone is drawn from the high of the oldest candle (bottom) up to the low of the newest candle (top). It begins at the time of the oldest candle.
Bearish FVG is created when all of these are true: - The high of the newest candle is below the low of the oldest candle. - The close of the middle candle is below the low of the oldest candle. - The same "no earlier gap" condition holds in the downward direction.
The zone is drawn from the high of the newest candle (bottom) up to the low of the oldest candle (top).
When is it checked? Detection runs when a bar of the source timeframe closes. On the chart timeframe this means once per new bar. For a higher source timeframe, a zone is added only after a bar of that timeframe has actually closed. Because the zones are built from closed candles only, a zone that has been drawn will not vanish simply because the forming candle changed. The "% left" text and the panel are the only elements that update on every tick.
What if I choose a source timeframe lower than the chart? The indicator never uses a timeframe lower than the chart's own. If the value you enter is smaller than the chart timeframe, the chart timeframe is used instead.
6. The Four Fill Methods
A zone is considered "filled" when price reaches a specific level inside or at the far edge of the zone. Different traders define "filled" differently, so the indicator lets you choose. The setting is called Fill and takes a number from 0 to 3. The default is 2, Wick Sweep.
- 0 – Any Touch: Bullish – the low of a candle reaches the top edge of the zone. Bearish – the high of a candle reaches the bottom edge of the zone.
- 1 – Midpoint: Bullish – the low of a candle reaches the middle of the zone. Bearish – the high of a candle reaches the middle of the zone.
- 2 – Wick Sweep (default): Bullish – the low of a candle reaches the bottom edge of the zone. Bearish – the high of a candle reaches the top edge of the zone.
- 3 – Body Beyond: Bullish – a candle closes at or below the bottom edge of the zone. Bearish – a candle closes at or above the top edge of the zone.
Any Touch (0). The most sensitive setting. The zone disappears the first time price touches it. Use this if you only care about untouched zones and want any contact to count as mitigation. With this method the "% left" label is not very informative, because the zone is removed on the first touch, so it will normally read 100% until it vanishes.
Midpoint (1). The zone is filled when price reaches its 50% level, which many traders call the consequent encroachment. A zone at 0% left under this method has been entered by half of its height.
Wick Sweep (2). The zone is considered filled only when a wick reaches the far edge, so the entire zone has been traded through. This is the default and gives the "% left" label its widest, most gradual range, from 100% down to 0% across the full height of the zone.
Body Beyond (3). The strictest setting. Wicks are ignored. The zone is filled only when a candle closes beyond the far edge. This is useful if you consider wick penetration to be noise and only accept a real close.
7. The "% Left" Label
7.1 What it shows
Every active FVG carries a small text label such as "72% left". It answers one question: how much of the distance to the fill level is still left?
- 100% left means price has not entered the zone yet.
- 50% left means price has gone halfway toward the fill level.
- 1% left means price is almost at the fill level.
- At 0%, the zone is filled and is removed from the chart together with its label.
The label is placed at the vertical middle of the zone, anchored at the right side near the current candle, and it uses the font size and font color you choose.
7.2 How it is calculated
The calculation depends on the fill method, because the "finish line" is different for each method.
- The indicator takes the entry edge of the zone. For a bullish FVG this is the top edge, because price enters from above. For a bearish FVG it is the bottom edge, because price enters from below.
- It takes the fill level from the selected method (top, middle or bottom edge, as described above).
- The distance between the entry edge and the fill level is the span that has to be covered.
- The indicator tracks the deepest point that price has reached inside the zone since the zone formed: the lowest low for a bullish FVG, the highest high for a bearish FVG. With Body Beyond, closes are used instead of wicks. The currently forming candle is included, so the label reacts in real time.
- The percentage left is: 100 × (1 − depth covered ÷ span). It is clamped between 0 and 100 and rounded up, so a zone that is not yet filled never shows 0%.
7.3 Why it uses the deepest point
The label is a measure of mitigation progress, not of where price happens to be right now. If price dips into a zone to 60% of its height and then moves away, the zone is still 60% mitigated. For that reason the percentage does not go back up when price leaves the zone. It only goes down as the maximum depth increases.
7.4 Examples
Wick Sweep, bullish FVG from 100.00 (bottom) to 102.00 (top). The entry edge is 102.00 and the fill level is 100.00, so the span is 2.00. If the lowest price since formation is 101.50, then 0.50 of 2.00 has been covered, which is 25%, and the label shows "75% left". If price later falls to 100.40, 1.60 of 2.00 is covered and the label shows "20% left". The zone is removed when price reaches 100.00.
8. Inverse FVG Lifecycle in Detail
- An FVG gets filled according to the selected fill method. It is removed from the list of active FVGs and its rectangle and "% left" label are removed from the chart.
- If IFVG tracking is enabled, the filled zone is moved to a watch list instead of being forgotten.
- The watch list is checked on every closed bar:
- If a candle closes beyond the far side of the original zone (below the bottom of a bullish zone or above the top of a bearish zone), an IFVG is created in the opposite direction.
- If a candle closes back on the original side of the zone (above the top of a bullish zone or below the bottom of a bearish zone), the zone is simply dropped. It held, so no IFVG is created.
- If the candle closes inside the zone, the indicator waits for the next closed bar.
- An active IFVG is drawn from the original start of the zone and extended to the right. It uses its own colors and carries a label: "IFVG (S)" if it is bullish and acts as support, "IFVG (R)" if it is bearish and acts as resistance.
- The IFVG is removed when a candle closes beyond it in the opposite direction: below the bottom of a bullish IFVG, or above the top of a bearish IFVG.
Creating an IFVG also counts as an event for the panel. The bias becomes BUY if a bullish IFVG was just created, and SELL if a bearish IFVG was just created.
The IFVG feature can be switched off completely. When it is off, filled zones are simply removed and no IFVG logic runs.
9. The Information Panel
The panel sits in the upper-left area of the chart by default and gives a compact summary of what the indicator currently sees. Please note that the panel text is written in Filipino (Tagalog) mixed with English technical terms, because the indicator was built for a Filipino trader. The meaning of every line is explained below, so you can use it without knowing the language.
- Title – FVG PANEL [DGT] – Name of the panel
- Trend – TREND: SELL – Current bias: BUY, SELL or NEUTRAL
- Last event – Huling event : FVG bearish @ 2026.10.25 23:00 – "Huling event" means "last event": the most recent FVG or IFVG that was created, with its date and time
- Active FVG – Aktibong FVG : bull 1 | bear 4 – "Aktibong" means "active": number of bullish and bearish FVG zones currently on the chart
- Active IFVG – Aktibong IFVG: bull 3 | bear 7 – Number of bullish and bearish IFVG zones currently on the chart
- Nearest – Pinakamalapit: bull 0 pts | bear 750 pts – "Pinakamalapit" means "nearest": distance in points from the current price to the closest bullish and the closest bearish FVG. 0 pts means price is inside or touching a zone. "--" means there is none
- Price location – Presyo : walang FVG sa presyo – "Presyo" means "price". Tells you whether price is inside a bullish FVG ("IN BULL FVG (support)"), inside a bearish FVG ("IN BEAR FVG (resistance)"), or in neither ("walang FVG sa presyo" means "no FVG at the price")
- FVG #2 bias – FVG #2 bias : OFF – The bias of the second source: BUY, SELL, "--" if it has not produced an event yet, or OFF if the second source is disabled
- Basis – Batayan: huling FVG/IFVG event | Fill: Wick Sweep – "Batayan" means "basis": a reminder that the trend line is based on the last FVG or IFVG event, and which fill method is active
9.1 How the trend verdict works
The TREND line is intentionally simple and transparent:
- BUY if the most recent FVG or IFVG event was bullish.
- SELL if the most recent FVG or IFVG event was bearish.
- NEUTRAL if no event has been recorded yet.
This is a state of the last event, not a prediction and not a measure of trend strength. It will flip each time a new event of the opposite direction appears, and a market that alternates between bullish and bearish gaps will make the verdict flip as well. Treat it as a quick summary of the most recent order-flow imbalance, and combine it with your own analysis, higher-timeframe context and risk management before you act on it.
10. Using a Second Timeframe (FVG #2)
The indicator contains two independent FVG sources.
- FVG #1 always runs. Its timeframe is set in minutes. A value of 0 means "use the chart timeframe".
- FVG #2 is optional. A value of 0 means it is turned off. Any other value is the timeframe in minutes whose gaps you want to see.
Typical timeframe values in minutes: 1 (M1), 5 (M5), 15 (M15), 30 (M30), 60 (H1), 240 (H4), 1440 (D1), 10080 (W1).
Example. You trade on an M5 chart. You leave FVG #1 at 0 so it shows M5 gaps, and set FVG #2 to 60 so the H1 gaps are drawn on the same chart in a different color. The M5 zones show you precise short-term levels, and the H1 zones show you the larger areas that may matter more.
Each source has its own pair of colors, one for bullish and one for bearish zones, so you can always see where a zone came from. The last event of FVG #2 is also shown on the panel as "FVG #2 bias". The overall TREND line still follows the most recent event from any source.
11. Input Reference
The input descriptions inside MT4 are written in short Filipino and English phrases. This table explains each one in English.
- FVG #1 TF (minutes) (default: 0) – Timeframe of the main FVG source in minutes. 0 = chart timeframe. A value lower than the chart timeframe falls back to the chart timeframe
- FVG #2 TF (minutes) (default: 0) – Timeframe of the second FVG source in minutes. 0 = off
- Fill method (default: 2) – 0 = Any Touch, 1 = Midpoint, 2 = Wick Sweep, 3 = Body Beyond
- Show IFVG (default: true) – Turns Inverse FVG tracking on or off
- Max zones (default: 40) – Maximum number of active FVG zones kept on the chart. When the limit is reached, the oldest zone is removed first
- Replay bars (default: 360) – Number of past bars processed when the indicator is loaded, so recent zones appear immediately. More bars means a longer look-back and slightly longer loading time
- Draw zones (default: true) – Draws rectangles and labels on the chart. When off, the indicator only updates the panel
- Show % left (default: true) – Shows the "% left" label on each active FVG
- % label font size (default: 8) – Font size of the "% left" label (also used for the IFVG label)
- % label color (bullish) (default: White) – Font color of the "% left" label on bullish zones
- % label color (bearish) (default: White) – Font color of the "% left" label on bearish zones
- FVG #1 bullish color (default: Teal (0,184,217)) – Fill color of bullish zones from source 1
- FVG #1 bearish color (default: Orange (255,139,0)) – Fill color of bearish zones from source 1
- FVG #2 bullish color (default: Mint (110,231,183)) – Fill color of bullish zones from source 2
- FVG #2 bearish color (default: Coral (255,107,107)) – Fill color of bearish zones from source 2
- IFVG bullish color (default: Dodger Blue) – Fill color of bullish IFVG zones
- IFVG bearish color (default: Magenta) – Fill color of bearish IFVG zones
- Show IFVG label (default: true) – Shows the "IFVG (S)" or "IFVG (R)" text on each IFVG
- IFVG label color (default: White) – Font color of the IFVG label
- Show panel (default: true) – Shows or hides the information panel
- Panel X (default: 10) – Panel distance from the left edge, in pixels
- Panel Y (default: 25) – Panel distance from the top edge, in pixels
12. Installation
- In MetaTrader 4, open File → Open Data Folder.
- Go to MQL4 → Indicators and copy the indicator file (the .mq4 source file or the compiled .ex4 file, depending on what you received) into that folder.
- If you have the .mq4 source, open it in MetaEditor and press Compile (F7). Check that there are no errors.
- Back in the terminal, right-click Navigator → Indicators and choose Refresh.
- Drag FVG DGT Panel [TMT] from the Navigator onto the chart you want, or double-click it.
- In the Inputs tab, adjust the settings you want and press OK.
13. Limitations
- The indicator does not issue alerts or notifications in this version.
- The third lower-timeframe FVG source and the "color on detection" candle coloring of the original Pine script are not included.
- The trend verdict follows the last event only. It is not a trend-strength measure and can change often in choppy markets.
- Results depend on your broker's price data. Brokers differ in gaps, spreads and history, so zones can look slightly different from one broker to another.
- A zone or an IFVG is an area of interest. Price may ignore it, react at its edge or trade straight through it.
14. Frequently Asked Questions
Does the indicator repaint? Zones are built from closed candles and do not change after they are drawn. Only the "% left" label and the panel move with the live candle.
Why does a zone disappear? Because it was filled according to the selected fill method, or because the maximum number of zones was exceeded and it was the oldest one.
Why do I see 100% on every label? With the Any Touch method, a zone is removed at first contact, so labels stay at 100% until the zone is gone. Use Midpoint, Wick Sweep or Body Beyond to see the percentage move.
Why can't I see IFVGs? Check that Show IFVG is on. IFVGs only appear after a filled zone is broken by a candle close on the far side. They have their own colors, so make sure those colors differ from your chart background.
Can I use it on any symbol and timeframe? Yes. It works on forex, metals, indices and crypto symbols that your MT4 broker offers, on any timeframe.
Does it trade for me? No. It only draws on the chart and never sends orders. You place and manage every trade yourself, so position size, stop loss and take profit always stay under your control. Always review each setup carefully before you act on it.
Is the panel text in English? Part of it is in Filipino, and each line is explained in section 9 of this description.
15. Credits and Risk Disclaimer
This indicator is a MetaTrader 4 port inspired by the "Fair Value Gaps by DGT" concept for TradingView. The additions described in this document, such as the "% left" label, the IFVG colors and labels, and the panel, were built for this MT4 version. All trademarks belong to their respective owners.
Risk warning. Trading foreign exchange, CFDs, metals, indices and cryptocurrencies involves a high level of risk and may not be suitable for everyone. You can lose some or all of your capital. This indicator is an analytical tool that displays information based on past price data. It does not predict the future, it does not guarantee profits and it is not financial advice. Past behavior of any pattern does not guarantee future results. Test any approach on a demo account first, use proper risk management, and never risk money you cannot afford to lose.
