AG Pro Fair Value Gap Engine [AGPro Series]AG Pro Fair Value Gap Engine
OVERVIEW / WHAT IT DOES
AG Pro Fair Value Gap Engine is a rules-based overlay built to detect 3-bar fair value gap structures and organize them as a living imbalance map on the chart.
The script identifies bullish fair value gaps when the current low is above the high from two bars earlier, and bearish fair value gaps when the current high is below the low from two bars earlier. Once detected, each zone is stored, rendered, tracked through time, and updated as price interacts with it.
Instead of stopping at basic FVG detection, this script continues to follow the structure after creation. It monitors whether the gap remains active, whether price returns into it, whether mitigation occurs, how old the structure has become, and how strong or weak that mitigation event appears relative to the gap itself.
The result is not just a visual list of imbalances. It is an FVG lifecycle model designed to help traders distinguish between fresh gaps, aging gaps, mitigated gaps, and higher-quality mitigation events.
UNIQUE EDGE
Many fair value gap tools simply highlight every detected gap and leave the user to interpret the rest.
This script is built around a different idea:
not all FVGs deserve the same attention, and not every mitigation event carries the same informational value.
AG Pro Fair Value Gap Engine separates itself by combining detection, aging, prioritization, mitigation tracking, and scoring in a single structured workflow. Gaps are not treated as static rectangles. They are treated as evolving chart objects with a lifecycle.
Within the AG Pro Series, this script is also distinct from breakout-quality, reclaim, rotation, pressure, or acceptance-style overlays. Those models focus on trend behavior, reclaim behavior, structural confirmation, momentum pressure, or price acceptance around a reference. This one is centered on imbalance structure itself: where the 3-bar gap formed, how long it stayed relevant, whether price returned, and how credible that mitigation looked once interaction happened.
In practical terms, the script is designed to answer questions such as:
Which FVGs are still active?
Which ones are becoming stale?
Which mitigation events happened with better quality?
Which visible zones are worth keeping in focus, and which are just legacy context?
That is the core difference. This is not a generic FVG highlighter. It is an imbalance-ranking and mitigation-quality engine.
METHODOLOGY
1) Detection Logic
The script scans for standard 3-bar fair value gap structures.
Bullish FVG:
current low > high from two bars back
Bearish FVG:
current high < low from two bars back
A minimum size filter relative to ATR is applied so that very small gaps can be ignored when desired.
2) Structure Tracking
After detection, each FVG is stored and tracked over time. The script keeps the zone on the chart, extends active zones forward when enabled, and updates their visual state as the market evolves.
This allows the chart to preserve the structural memory of imbalance zones instead of treating every new gap as an isolated event.
3) Aging and Visual Decay
Older gaps gradually lose visual priority through fade logic. This helps newer or more relevant structures stay readable while old zones move into the background.
Optional controls can also suppress distant legacy zones when they become both old and far from current price.
4) Mitigation Logic
The script monitors how deeply price returns into each gap. When the user-defined mitigation threshold is reached, the FVG is marked as mitigated.
Mitigated zones can remain visible as context or be hidden for a cleaner chart, depending on preference.
5) Quality Scoring
Mitigation is not treated as a simple yes/no event. The script evaluates mitigation quality using a weighted model that includes:
- Gap size relative to ATR
- Speed of return into the zone
- Relative volume during the mitigation event
- Return strength after contact with the gap
This produces a normalized score intended to help separate weaker fills from stronger, better-formed mitigation behavior.
6) Focus and Prioritization
To reduce chart noise, the script includes focused labeling, active-zone prioritization, top-zone filtering, and legacy suppression logic.
This means the visual output can be tuned away from “show everything” and toward “show what matters most.”
SIGNALS & ALERTS
This script provides alert conditions for:
- Newly detected bullish fair value gaps
- Newly detected bearish fair value gaps
- Bullish fair value gaps reaching mitigation
- Bearish fair value gaps reaching mitigation
These alerts are event-based and rules-based. They are not forecasts, predictions, or trade instructions.
The labels and panel are designed to summarize state, not to replace the user’s broader market process.
KEY INPUTS
Core Settings
- Minimum FVG Size (ATR)
- Mitigation Threshold (%)
- Maximum Tracked FVG Count
- Age Fade Length
- Extend Active FVG Boxes
Scoring Engine
- Speed Score Reference
- Volume Score SMA Length
- Volume Score Max Ratio
- Size Score Max ATR
Visual Settings
- Show FVG Labels
- Focused Label Mode
- Focused Label Minimum Score
- Active / Mitigated Label Age Limits
- Highlight Score Threshold
- Theme Preset
- Show Mitigated Zones
- Show Mitigated Zone Labels
- Label Horizontal Offset
- Hide Distant Legacy FVGs
- Legacy Hide Age
- Legacy Hide Distance
- Show Only Top Active Zones
- Top Active Zones Count
- Label Stack Spacing
Panel Settings
- Show Panel
- Panel Position
- Panel Font Size
These controls allow the same logic to be used in a more information-dense mode or in a much cleaner presentation mode, depending on the charting style of the user.
LIMITATIONS & TRANSPARENCY
This script detects and organizes 3-bar imbalance structures. It does not claim to identify every meaningful liquidity event, order-flow shift, or broader smart money context factor on its own.
A fair value gap can remain open for a long time, fail quickly, or be revisited multiple times. A high score does not guarantee a directional outcome. A low score does not automatically invalidate the zone as context.
The mitigation score is a structured ranking model, not an objective truth about future price behavior. It is designed to help compare events inside the framework of this script.
Because chart structure, volatility, timeframe, and instrument behavior vary, users should expect different FVG densities and different score distributions across markets.
This tool is best used as a market-organization layer for imbalance analysis, not as a standalone execution system.
RISK DISCLOSURE
AG Pro Fair Value Gap Engine is an analytical charting tool for educational and informational use.
It does not provide financial advice, does not promise outcomes, and should not be interpreted as a standalone buy or sell system. Fair value gaps, mitigation events, and score readings should be evaluated together with market structure, volatility, timeframe context, liquidity conditions, and the user’s own risk framework.
Trading involves risk. Past chart behavior does not guarantee future results.
Индикатор Pine Script®






















