OPEN-SOURCE SCRIPT

Liquidation Heatmap [Alpha Extract]

447
A sophisticated liquidity zone visualization system that identifies and maps potential liquidation levels based on swing point analysis with volume-weighted intensity measurement and gradient heatmap coloring. Utilizing pivot-based pocket detection and ATR-scaled zone heights, this indicator delivers institutional-grade liquidity mapping with dynamic color intensity reflecting relative liquidity concentration. The system's dual-swing detection architecture combined with configurable weight metrics creates comprehensive liquidation level identification suitable for strategic position planning and market structure analysis.

🔶 Advanced Pivot-Based Pocket Detection

Implements dual swing width analysis to identify potential liquidation zones at pivot highs and lows with configurable lookback periods for comprehensive level coverage. The system detects primary swing points using main pivot width and optional secondary swing detection for increased pocket density, creating layered liquidity maps that capture both major and minor liquidation levels across extended price history.

🔶 Multi-Metric Weight Calculation Engine

Features flexible weight source selection including Volume, Range (high-low spread), and Volume × Range composite metrics for liquidity intensity measurement. The system calculates pocket weights based on market activity at pivot formation, enabling traders to identify which liquidation levels represent higher concentration of potential stops and liquidations with configurable minimum weight thresholds for noise filtering.

🔶 ATR-Based Zone Height Framework

Utilizes Average True Range calculations with percentage-based multipliers to determine pocket vertical dimensions that adapt to market volatility conditions. The system creates ATR-scaled bands above swing highs for short liquidation zones and below swing lows for long liquidation zones, ensuring zone heights remain proportional to current market volatility for accurate level representation.

🔶 Dynamic Gradient Heatmap Visualization

Implements sophisticated color gradient system that maps pocket weights to intensity scales, creating intuitive visual representation of relative liquidity concentration. The system applies power-law transformation with configurable contrast adjustment to enhance differentiation between weak and strong liquidity pockets, using cyan-to-blue gradients for long liquidations and yellow-to-orange for short liquidations.

🔶 Intelligent Pocket State Management

Features advanced pocket tracking system that monitors price interaction with liquidation zones and updates pocket states dynamically. The system detects when price trades through pocket midpoints, marking them as "hit" with optional preservation or removal, and manages pocket extension for untouched levels with configurable forward projection to maintain visibility of approaching liquidity zones.

🔶 Real-Time Liquidity Scale Display

Provides gradient legend showing min-max range of pocket weights with 24-segment color bar for instant liquidity intensity reference. The system positions the scale at chart edge with volume-formatted labels, enabling traders to quickly assess relative strength of visible liquidation pockets without numerical clutter on the main chart area.

🔶 Touched Pocket Border System

Implements visual confirmation of executed liquidations through border highlighting when price trades through pocket zones. The system applies configurable transparency to touched pocket borders with inverted slider logic (lower values fade borders, higher values emphasize them), providing clear historical record of liquidated levels while maintaining focus on active untouched pockets.

🔶 Dual-Swing Density Enhancement

Features optional secondary swing width parameter that creates additional pocket layer with tighter pivot detection for increased liquidation level density. The system runs parallel pivot detection at both primary and secondary swing widths, populating chart with comprehensive liquidity mapping that captures both major swing liquidations and intermediate level clusters.

🔶 Adaptive Pocket Extension Framework

Utilizes intelligent time-based extension that projects untouched pockets forward by configurable bar count, maintaining visibility as price approaches potential liquidation zones. The system freezes touched pocket right edges at hit timestamps while extending active pockets dynamically, creating clear distinction between historical liquidations and forward-projected active levels.

🔶 Weight-Based Label Integration

Provides floating labels on untouched pockets displaying volume-formatted weight values with dynamic positioning that follows pocket extension. The system automatically manages label lifecycle, creating labels for new pockets, updating positions as pockets extend, and removing labels when pockets are touched, ensuring clean chart presentation with relevant liquidity information.

🔶 Performance Optimization Framework

Implements efficient array management with automatic clean-up of old pockets beyond lookback period and optimized box/label deletion to maintain smooth performance. The system includes configurable maximum object counts (500 boxes, 50 labels, 100 lines) with intelligent removal of oldest elements when limits are approached, ensuring consistent operation across extended timeframes.

This indicator delivers sophisticated liquidity zone analysis through pivot-based detection and volume-weighted intensity measurement with intuitive heatmap visualization. Unlike simple support/resistance indicators, the Liquidation Heatmap combines swing point identification with market activity metrics to identify where concentrated liquidations are likely to occur, while the gradient color system instantly communicates relative liquidity strength. The system's dual-swing architecture, configurable weight metrics, ATR-adaptive zone heights, and intelligent state management make it essential for traders seeking strategic position planning around institutional liquidity levels across cryptocurrency, forex, and futures markets. The visual heatmap approach enables instant identification of high-probability reversal zones where cascading liquidations may trigger significant price reactions.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.