Fair Value Gap [tambangEA]Fair Value Gap is a lightweight Fair Value Gap (FVG) / imbalance indicator designed to map institutional displacement zones across up to three configurable higher/lower timeframes on a single chart.
It detects bullish and bearish FVGs, tracks how price interacts with them over time, supports partial mitigation, and can optionally highlight zones only when multiple timeframes overlap (alignment)—so you focus on the most “confluent” areas.
What this script plots
Bullish FVG (demand imbalance)
Formed when price leaves a gap upward (strong impulse). Typically treated as a potential discount re-entry zone.
Bearish FVG (supply imbalance)
Formed when price leaves a gap downward (strong impulse). Typically treated as a potential premium re-entry zone.
50% Midline (optional)
The equilibrium of a zone (often used as a “balance point” for reaction/mitigation logic).
Balanced / Unbalanced tagging (info label)
Based on how much of the original zone has been filled.
Info labels (optional) showing:
TF source of the zone
Current zone size
Zone age (bars since created)
Displacement score (impulse quality)
Fill % and status tag
How FVG detection works (logic summary)
This indicator uses a 3-candle FVG model per selected timeframe:
A zone is created only when the FVG structure is valid and the impulse candle shows meaningful displacement.
Displacement is measured using an ATR-normalized score:
dispScore = candle body / (ATR / divider)
Zones are created only when dispScore > threshold
This filters weak gaps and keeps the chart cleaner.
Mitigation behavior (full & partial)
Mitigation Type
Wick: a zone is removed once price fully trades through it (by wick).
Close: a zone is removed only when price closes through it (stricter).
Partial Mitigation Mode
Off: zones remain unchanged until fully mitigated.
Shrink: the zone compresses as price trades into it.
Step 25/50/75%: mitigation happens in discrete steps based on the original zone size.
This makes zones more realistic and helps you read how much liquidity/imbalance has been “consumed”.
Multi-TF Alignment (Confluence Highlighting)
You can require zones to be highlighted only when they overlap with zones from other timeframes:
Alignment = 1 → show all zones from enabled TFs
Alignment = 2 → highlight zones that overlap across 2+ TFs
Alignment = 3 → highlight zones that overlap across all enabled TFs
This is useful for finding high-importance zones where multiple TF imbalances stack.
Merge overlapping zones (clean + faster)
When enabled, overlapping or near-overlapping zones merge into one larger zone.
This reduces object count, improves chart readability, and keeps the script lighter.
Filters (optional)
Session filter: display/detect zones only during your active session window (timezone configurable).
News windows (manual): block detection during manually defined windows (e.g., CPI / FOMC).
Volatility filter (ATR%): only detect zones when volatility is inside your chosen ATR% range.
These filters help avoid “junk zones” during dead markets or chaotic spikes.
How to use in trading (practical workflow)
1) Trend context (recommended)
Use any simple structure filter (HTF swing, market structure, EMA, etc.):
In an uptrend: prioritize bullish FVGs as pullback entries.
In a downtrend: prioritize bearish FVGs as pullback entries.
2) Confluence first
Focus on zones highlighted by Alignment 2 or 3:
These zones usually act stronger because multiple TFs agree on the imbalance area.
3) Entry ideas (common approaches)
Conservative: wait for price to enter a bullish FVG and reclaim the 50% midline, then confirm with LTF structure shift.
Aggressive: enter at the zone boundary with tight invalidation beyond the zone.
4) Risk management
Typical invalidation logic:
Bullish zone invalidation: price fully trades through (or closes through, depending on mode).
Bearish zone invalidation: price fully trades through (or closes through).
Use the zone edges and midline to structure:
Entry
Stop placement
Partial take profits
Performance tips
Keep Max FVG Storage moderate (e.g., 5–10).
Enable Merge to reduce clutter and object count.
Use Alignment 2/3 to limit visible zones to higher quality.
If you trade very low timeframes, reduce enabled TF count to keep it smooth.
Notes / Disclaimer
This indicator is a visual decision-support tool, not a complete trading system.
Always validate zones with market structure, liquidity context, and strict risk management. Past performance is not indicative of future results.
Penunjuk Pine Script®






















