OPEN-SOURCE SCRIPT
Dynamic Mitigation Imbalances - Price Invasion Tracking

### Overview
This closed-source indicator introduces a novel methodology for tracking market inefficiencies (Imbalances / Fair Value Gaps) by incorporating a real-time, price-action-driven dynamic resizing mechanism. Unlike conventional FVG indicators that keep blocks static until full mitigation or delete them abruptly upon a simple touch, this script visually "consumes" and shrinks the historical boxes proportionally to price invasion.
### Core Logic & Mathematical Concepts
The script scans consecutive candle sequences to detect structurally significant displacement zones:
- **Bearish Imbalances:** Identified when a green candle sequence encounters a red sequence, and the lowest low of the green origin remains completely above the high of the current corrective development.
- **Bullish Imbalances:** Identified when a red candle sequence meets a green sequence, leaving a price gap where the highest high of the red origin remains below the low of the current corrective development.
### The Innovation: Dynamic Consumption
The cornerstone of this script is its dynamic recalculation engine via arrays:
1. **Original Metrics Storage:** The script memorizes the absolute height (size) of the original inefficiency upon creation.
2. **Invasion Tracking:** As subsequent candles develop, the script monitors intra-bar tracking (`high[0]` for bearish zones, `low[0]` for bullish zones). If the price breaches the box limits, the dimensions are recalculated on the fly (`box.set_bottom()` / `box.set_top()`), visually shrinking the box area.
3. **Percentage-Based Elimination Threshold:** Through an adjustable input parameter (`pctMitigacion`), users can establish an exact percentage threshold (e.g., 95%). The indicator actively calculates:
Remaining Size <= Original Size * (1.0 - Mitigation Factor)
Once this threshold is breached, the script efficiently flushes the box data from memory.
### How to Use
- **Visualizing Inefficiencies:** Broad zones display active, unmitigated market gaps.
- **Shrinking Boxes:** A shrinking box indicates institutional orders are actively filling the liquidity vacuum.
- **Execution Areas:** The remaining unmitigated fractions of the boxes serve as highly precise refined zones for entry or risk management.
This closed-source indicator introduces a novel methodology for tracking market inefficiencies (Imbalances / Fair Value Gaps) by incorporating a real-time, price-action-driven dynamic resizing mechanism. Unlike conventional FVG indicators that keep blocks static until full mitigation or delete them abruptly upon a simple touch, this script visually "consumes" and shrinks the historical boxes proportionally to price invasion.
### Core Logic & Mathematical Concepts
The script scans consecutive candle sequences to detect structurally significant displacement zones:
- **Bearish Imbalances:** Identified when a green candle sequence encounters a red sequence, and the lowest low of the green origin remains completely above the high of the current corrective development.
- **Bullish Imbalances:** Identified when a red candle sequence meets a green sequence, leaving a price gap where the highest high of the red origin remains below the low of the current corrective development.
### The Innovation: Dynamic Consumption
The cornerstone of this script is its dynamic recalculation engine via arrays:
1. **Original Metrics Storage:** The script memorizes the absolute height (size) of the original inefficiency upon creation.
2. **Invasion Tracking:** As subsequent candles develop, the script monitors intra-bar tracking (`high[0]` for bearish zones, `low[0]` for bullish zones). If the price breaches the box limits, the dimensions are recalculated on the fly (`box.set_bottom()` / `box.set_top()`), visually shrinking the box area.
3. **Percentage-Based Elimination Threshold:** Through an adjustable input parameter (`pctMitigacion`), users can establish an exact percentage threshold (e.g., 95%). The indicator actively calculates:
Remaining Size <= Original Size * (1.0 - Mitigation Factor)
Once this threshold is breached, the script efficiently flushes the box data from memory.
### How to Use
- **Visualizing Inefficiencies:** Broad zones display active, unmitigated market gaps.
- **Shrinking Boxes:** A shrinking box indicates institutional orders are actively filling the liquidity vacuum.
- **Execution Areas:** The remaining unmitigated fractions of the boxes serve as highly precise refined zones for entry or risk management.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.