OPEN-SOURCE SCRIPT

Simulated Liquidation Heatmap [QuantAlgo]

199
๐ŸŸข Overview

This indicator visualizes where clusters of stop-loss orders and liquidation levels are likely located, displayed as a 'heatmap'. It's based on the concept of market structure liquidity: large groups of stop orders tend to gather around obvious technical levels (like swing highs and lows), and these pools of orders often attract price movement from institutional traders. The indicator uses a fractal-based algorithm to identify these high-probability liquidation zones and displays them as dynamic, color-coded boxes.

The key feature is the thermal color gradient, which indicates the freshness (age) and therefore the relative relevance of the liquidity zone. Hot colors (e.g., Red/Yellow) represent fresh clusters that have just formed, suggesting strong and immediate liquidity interest. Cold colors (e.g., Blue/Purple) represent aged or decaying clusters that are becoming less relevant over time. This visualization allows traders to anticipate potential liquidity sweeps (stop hunts) and understand areas of significant retail and institutional positioning.
snapshot
๐ŸŸข Key Features

1. Liquidity Zone Heatmap

The core function is the identification of swing high and swing low price points using a user-defined Lookback period. These points are where retail traders are statistically most likely to place their stop-loss orders. The indicator simulates the clustering of these orders by drawing a zone (box) around the detected swing point, with the vertical size controlled by the Stop/Liquidation Zone Width (%) setting.

โ–ถ Cluster Lookback: Defines the sensitivity of swing point detection. Lower values detect frequent, minor zones (scalping/intraday); higher values detect major, stronger swing points (swing trading).

โ–ถ Zone Width (%): Sets the percentage range above and below the swing point where stops are simulated to cluster, accounting for slippage and typical stop placement spread.

โ–ถ Liquidity Decay: Zones gradually fade in color intensity and are eventually removed after the user-defined Liquidity Decay Period (Bars), ensuring the heatmap only displays relevant, current liquidity areas.

โ–ถ Round Number Filter: An optional filter that limits the display to liquidity zones occurring only at psychologically significant round numbers (e.g., $100, $1,500.00), which typically attract higher concentrations of orders.
snapshot
2. Thermal Color Gradient

The heatmap's color is a direct function of the zone's age, providing a visual proxy for immediate relevance.

โ–ถ Freshness: Newly created zones are displayed in the Hot Color (high relevance).

โ–ถ Decay: As bars pass, the zone color transitions along the gradient toward the Cold Color and increased transparency (lower relevance), until it is removed entirely.
snapshot
โ–ถ Color Schemes: Multiple pre-configured and custom color schemes are available to optimize the visualization for different chart themes and color preferences.
snapshot
snapshot
snapshot
snapshot
snapshot
snapshot
snapshot
snapshot
3. Liquidity Heat Thermometer

An optional visual thermometer is displayed on the chart to provide an instant, overall assessment of the current liquidation heat level in the immediate vicinity of the price.

โ–ถ Calculation: The thermometer calculates an aggregate heat score based on the age and proximity of all liquidity zones within a user-defined Zone Detection Range (%) of the current price.

โ–ถ Visual Feedback: A marker (triangle) points to the corresponding level on the thermometer's color gradient (Hot to Cold). A high reading indicates price is close to fresh, dense stop clusters, suggesting high volatility or an imminent liquidity sweep is probable. A low reading indicates price is in a low-density or aged liquidity area.

โ–ถ Customization: The thermometer's resolution, position, and text size are fully customizable for optimal chart placement and readability.
snapshot
๐ŸŸข Practical Applications

โ–ถ Anticipate Sweeps: Prioritize trading in the direction of Hot (fresh) liquidity zones. For example, a hot low-side zone suggests strong sell-side liquidity (stop-losses) is available for large buyers to sweep.

โ–ถ Filter Noise: Use the Round Number Filter to focus only on the highest probability liquidation zones, which are often at clean, psychological price levels.

โ–ถ Validate Entries: Combine the Heat Thermometer with price action analysis. A rising heat level indicates increasing proximity to a major stop cluster, signaling a potential turn or an aggressive market move to sweep those stops.

โ–ถ Risk Management: Understand that price often acts dynamically around these zones. High heat levels imply high risk/reward setups; stops should be placed strategically beyond the defined Liquidation Zone Width.

โ–ถ Multi-Timeframe Context: Higher timeframes (e.g., Daily, 4-Hour) often reveal more significant, major liquidity zones. Use this indicator on lower timeframes (e.g., 5-min, 15-min) for execution, but prioritize zones that align with higher-timeframe structures.

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.