OPEN-SOURCE SCRIPT
Liquidity Gravity Map [PhenLabs]

📊 Liquidity Gravity Map [PhenLabs]
Version: PineScript™ v6

📌 Description
The Liquidity Gravity Map is an advanced, quantitative approach to dynamic support and resistance detection. Rather than simply plotting static lines at prior highs and lows, this indicator treats liquidity as a gravitational force that accumulates, decays, and dynamically shifts based on price action and volume. It builds a real-time, scored “map” of liquidity zones on your chart, quantifying their structural integrity, mitigation behavior, and time-based decay.
It is designed to solve the problem of chart clutter and “false zones.” By continuously scoring and pruning liquidity pools based on their real-time relevance, structural significance, and VWAP acceptance, traders are presented only with the most critical, high-probability areas of interest where price is likely to be attracted or rejected.
🚀 Points of Innovation
🔧 Core Components
🔥 Key Features
🎨 Visualization
📖 Usage Guidelines
Core Settings
VWAP Acceptance Settings
Visual Settings
✅ Best Use Cases
⚠️ Limitations
💡 What Makes This Unique
🔬 How It Works
1. Detection & Generation:
The script continuously monitors for structural pivots and significant wicks. When detected, a zone is created with an initial strength score based on structural clustering and ATR.
2. Continuous Evaluation:
Every confirmed bar, the script updates active zones. It tracks if price has touched the zone, penetrated it, or been rejected, factoring in relative volume to determine if the liquidity was absorbed or broken.
3. Scoring & Display:
A final 0-100 score is computed using structural integrity, VWAP context, wicks, revisits, decay, and proximity to current price. Only the top “N” scoring zones are dynamically rendered on the chart.
Version: PineScript™ v6
📌 Description
The Liquidity Gravity Map is an advanced, quantitative approach to dynamic support and resistance detection. Rather than simply plotting static lines at prior highs and lows, this indicator treats liquidity as a gravitational force that accumulates, decays, and dynamically shifts based on price action and volume. It builds a real-time, scored “map” of liquidity zones on your chart, quantifying their structural integrity, mitigation behavior, and time-based decay.
It is designed to solve the problem of chart clutter and “false zones.” By continuously scoring and pruning liquidity pools based on their real-time relevance, structural significance, and VWAP acceptance, traders are presented only with the most critical, high-probability areas of interest where price is likely to be attracted or rejected.
🚀 Points of Innovation
- Composite Scoring Engine: Zones are not binary. They are graded on a 0-100 scale using 7 distinct metrics: Structure, Revisits, Wicks, VWAP Context, Mitigation, Decay, and Proximity.
- Dynamic Memory Allocation: Employs an internal memory cap (Max Zones) and a pruning algorithm to actively remove ancient, low-scoring zones, keeping the chart responsive and clean.
- VWAP Acceptance Context: Integrates Session VWAP and Standard Deviation bands. The indicator scores zones higher if their creation aligns with bullish VWAP reclaims or bearish VWAP rejections.
- Mitigation & Absorption Tracking: Dynamically evaluates how price interacts with a zone. It tracks volume, penetration depth, and displacement to quantify if a zone is being absorbed (defended) or broken.
- Time-Decay Function: Untouched liquidity zones lose their “gravitational pull” over time via an exponential decay function, prioritizing fresh liquidity.
🔧 Core Components
- Zone Detection Algorithm: Identifies swing highs/lows and stop-hunt wicks, factoring in equal highs/lows clustering and wick ratios to establish initial structural strength.
- Session VWAP Engine: Calculates volume-weighted average price and its standard deviations over configurable sessions (RTH, Day, Week, Month) to gauge macro context and acceptance.
- Revisit Tracker: Monitors how many times a zone is tested. A zone’s score adjusts based on its frequency of testing relative to other active zones on the chart.
🔥 Key Features
- Live Composite Score (0-100) dynamically updated per zone.
- Automatic culling of stale, irrelevant liquidity levels.
- Highly customizable lookback, zone sensitivity, and memory caps.
- Dynamic gradient coloring based on zone score (Bullish/Bearish).
- Toggleable Zone Labels displaying directional bias, score, and revisit count.
🎨 Visualization
- Gradient Liquidity Boxes: Visualizes liquidity zones as shaded boxes. The opacity and color temperature (cool to warm) dynamically change based on the zone’s live composite score.
- VWAP Bands: Optional visual overlay of the Session VWAP and ±1σ / ±2σ standard deviation bands.
- Zone Labels: Small text labels attached to active boxes indicating “BULL” or “BEAR”, the “LG” (Liquidity Gravity) score, and “R” (Revisits).
📖 Usage Guidelines
Core Settings
- Lookback Period: (Default: 120) Determines the window for identifying stop-hunts and aging cleanup.
- Zone Sensitivity: (Default: 3.0) Controls the width of the generated zones and the tolerance for merging equal highs/lows. Higher values create wider, merged bands.
- Max Visible Zones: (Default: 8) The maximum number of top-scoring zones to render on the chart at one time.
- Score Decay Rate: (Default: 0.010) The exponential rate at which a zone’s score drops while untouched.
VWAP Acceptance Settings
- VWAP Session Type: (Default: Day) Anchor period for the VWAP calculations (RTH, Day, Week, Month).
- RTH Session: (Default: 0930-1600) Defines Regular Trading Hours if “RTH” is selected as the session type.
Visual Settings
- Color Theme: (Default: Classic) Choose between Classic, Neon, or Monochrome color palettes for the zone gradients.
✅ Best Use Cases
- Identifying high-probability reversal areas for mean-reversion trading.
- Spotting areas where trapped liquidity (stop-hunts) is likely to act as a strong magnet for price.
- Filtering out weak support/resistance levels by relying on the composite score to highlight only structurally significant, defended zones.
⚠️ Limitations
- Rapidly changing volatility can cause sudden shifts in zone width, as it is dynamically tied to the Average True Range (ATR).
- Because the map limits the number of visible zones to the highest scoring ones, a valid but slightly lower-scoring zone might be hidden from view.
💡 What Makes This Unique
- Quantitative Liquidity Modeling: Most indicators draw static boxes at highs/lows. This script dynamically evaluates the “health” of a zone through continuous math—scoring penetration, volume absorption, decay, and VWAP alignment.
🔬 How It Works
1. Detection & Generation:
The script continuously monitors for structural pivots and significant wicks. When detected, a zone is created with an initial strength score based on structural clustering and ATR.
2. Continuous Evaluation:
Every confirmed bar, the script updates active zones. It tracks if price has touched the zone, penetrated it, or been rejected, factoring in relative volume to determine if the liquidity was absorbed or broken.
3. Scoring & Display:
A final 0-100 score is computed using structural integrity, VWAP context, wicks, revisits, decay, and proximity to current price. Only the top “N” scoring zones are dynamically rendered on the chart.
💡 Note: Ensure your chart data provides reliable volume data, as the absorption and VWAP scoring mechanics heavily rely on it for accurate calculations.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.