OPEN-SOURCE SCRIPT
Ranked FVG Imbalance Zones (Zeiierman)

█ Overview
Ranked FVG Imbalance Zones (Zeiierman) is a next-generation Fair Value Gap tool that transforms how imbalances are evaluated by ranking them in real time using structured data and Pine Script’s latest UDT collection sorting capabilities.
Instead of plotting every detected gap equally, the script stores each FVG as a structured object, evaluates its quality using multiple factors, and dynamically ranks all active zones. The result is a cleaner, more actionable view of only the highest-priority imbalances.
This approach reduces noise and shifts focus toward the zones that matter most under current market conditions.

█ How It Works
⚪ Structured FVG Objects (UDT Engine)
Each detected FVG is stored as a user-defined type (UDT), containing:
This allows every imbalance to behave like a data object rather than a simple drawn box.
⚪ Multi-Factor Quality Scoring
Each FVG is assigned a dynamic quality score based on:
This converts raw imbalances into comparable signals with measurable strength.
⚪ UDT Collection Sorting (New Pine Feature)
All FVG objects are stored inside an array and sorted using:
Pine Script®
This uses TradingView’s new ability to sort collections of user-defined types directly by a field. Instead of manually filtering or iterating through values, the script ranks all zones instantly and efficiently using native sorting.
⚪ Ranked Output (Signal Prioritization)
After sorting, only the highest-ranked FVGs are displayed.
Lower-quality zones remain stored internally but are hidden from view. This creates a priority-based map of imbalances, where the chart highlights only the most relevant opportunities.
⚪ Strength Distribution (Internal Pressure View)
Each FVG is split into bullish and bearish strength components.
These are displayed as internal bars within the zone, showing:
█ Why This Approach Is Different
⚪ Ranking vs Filtering
Traditional FVG tools rely on fixed rules (size thresholds, simple conditions).
This tool instead ranks all zones relative to each other, adapting dynamically to market conditions.
⚪ Native Sorting Advantage
Using Pine’s new UDT sorting:
This was not efficiently possible before UDT collection sorting.
⚪ Noise Reduction
By showing only the top-ranked zones:
█ How to Use
⚪ Focus on Top Zones
Only the highest-ranked FVGs are shown. These represent the strongest imbalances based on current conditions.

⚪ Read Strength Internals

█ Settings
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Ranked FVG Imbalance Zones (Zeiierman) is a next-generation Fair Value Gap tool that transforms how imbalances are evaluated by ranking them in real time using structured data and Pine Script’s latest UDT collection sorting capabilities.
Instead of plotting every detected gap equally, the script stores each FVG as a structured object, evaluates its quality using multiple factors, and dynamically ranks all active zones. The result is a cleaner, more actionable view of only the highest-priority imbalances.
This approach reduces noise and shifts focus toward the zones that matter most under current market conditions.
█ How It Works
⚪ Structured FVG Objects (UDT Engine)
Each detected FVG is stored as a user-defined type (UDT), containing:
- Price range (top and bottom)
- Direction (bullish or bearish)
- Size and age
- Mitigation state
- Volume and trend alignment
- Bullish and bearish strength components
- Final quality score
This allows every imbalance to behave like a data object rather than a simple drawn box.
⚪ Multi-Factor Quality Scoring
Each FVG is assigned a dynamic quality score based on:
- Gap size relative to volatility
- Volume expansion vs average
- Trend alignment (EMA-based)
- Candle strength and displacement
- Mitigation progress and age decay
This converts raw imbalances into comparable signals with measurable strength.
⚪ UDT Collection Sorting (New Pine Feature)
All FVG objects are stored inside an array and sorted using:
fvgs.sort(order.descending, sort_field = "qualityScore")
This uses TradingView’s new ability to sort collections of user-defined types directly by a field. Instead of manually filtering or iterating through values, the script ranks all zones instantly and efficiently using native sorting.
⚪ Ranked Output (Signal Prioritization)
After sorting, only the highest-ranked FVGs are displayed.
Lower-quality zones remain stored internally but are hidden from view. This creates a priority-based map of imbalances, where the chart highlights only the most relevant opportunities.
⚪ Strength Distribution (Internal Pressure View)
Each FVG is split into bullish and bearish strength components.
These are displayed as internal bars within the zone, showing:
- Who controlled the move
- Whether the imbalance is stable or weak
- If opposing pressure exists inside the gap
█ Why This Approach Is Different
⚪ Ranking vs Filtering
Traditional FVG tools rely on fixed rules (size thresholds, simple conditions).
This tool instead ranks all zones relative to each other, adapting dynamically to market conditions.
⚪ Native Sorting Advantage
Using Pine’s new UDT sorting:
- Eliminates complex manual ranking logic
- Improves performance and scalability
- Allows real-time reordering as conditions change
- Enables true “top N” selection of signals
This was not efficiently possible before UDT collection sorting.
⚪ Noise Reduction
By showing only the top-ranked zones:
- Chart clutter is reduced
- Focus shifts to high-quality setups
- Decision-making becomes clearer
█ How to Use
⚪ Focus on Top Zones
Only the highest-ranked FVGs are shown. These represent the strongest imbalances based on current conditions.
⚪ Read Strength Internals
- Higher directional strength → stronger continuation potential
- Mixed strength → weaker or more reactive zone
- Opposing strength dominance → higher chance of failure or fill
█ Settings
- Show Top Zones: Controls how many of the highest-ranked FVGs are displayed.
- Max Stored FVGs: Controls how many zones are tracked internally.
- Volume Length: Defines the baseline for volume comparison.
- Trend Length: Defines the EMA used for trend alignment scoring.
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Access my indicators at: zeiierman.com
Join Our Free Discord: discord.gg/zeiiermantrading
Join Our Free Discord: discord.gg/zeiiermantrading
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Access my indicators at: zeiierman.com
Join Our Free Discord: discord.gg/zeiiermantrading
Join Our Free Discord: discord.gg/zeiiermantrading
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.