Historical Liquidity Proximity Heatmap [LuxAlgo]The Historical Liquidity Proximity Heatmap indicator highlights historical swing levels closest to the current price, using a volumetric heatmap to visualize potential areas of support and resistance.
One buy-side and sell-side volume-weighted average is also returned to provide clear breakout indications.
🔶 USAGE
This tool is designed to identify where significant liquidity resides by tracking historical pivot points and sorting them based on their proximity to the current price. By focusing on levels nearest to the market, traders can see a real-time "map" of potential structural obstacles or targets.
🔹 Identifying Liquidity Clusters
The indicator plots dots representing the nearest historical pivot highs (above price) and pivot lows (below price). When multiple dots are tightly packed together, it indicates a significant liquidity zone where historical price action was concentrated. The color of these dots is determined by the volume recorded at the time the pivot was formed:
High-Contrast Colors: Represent pivots formed on high volume, suggesting stronger institutional interest or "heavier" liquidity. Low-Contrast Colors: Represent pivots formed on lower volume, which may represent lighter liquidity zones.
🔹 Level Tests and Sweeps
Traders can monitor how price reacts as it approaches the nearest dots. If price touches a dot and immediately rejects, it confirms the historical level as active resistance or support. A "Liquidity sweep" occurs when price moves rapidly through one or more dots, clearing the nearest historical structures before a potential reversal or continuation.
🔹 Breakouts and Volumetric Averages
The indicator includes two dashed lines representing the Volume-Weighted Swing Average of the displayed liquidity points.
Volume-Weighted Highs: A dotted red line representing the average price of the nearest P pivot highs, weighted by their historical volume. Volume-Weighted Lows: A dotted green line representing the average price of the nearest P pivot lows, weighted by their historical volume.
A breakout above or below these Volumetric Averages suggests that the market has cleared the weighted "supply" or "demand" of the immediate vicinity, often leading to increased volatility.
🔶 DETAILS
The script maintains a historical buffer of pivots. On every bar, the script filters all stored pivots to identify those currently above the price (highs) and those currently below the price (lows).
These filtered levels are then sorted by price distance. The top P closest levels are selected for display. This ensures that the heatmap always focuses on the most relevant price levels regardless of how far the market has moved from older structures.
The color themes (Viridis, Magma, etc.) are perceptually uniform, meaning the transition from low-volume colors to high-volume colors is mathematically linear to the human eye, making it easier to gauge relative "liquidity weight" at a glance.
🔶 SETTINGS
🔹 Pivots
Pivot Left/Right Length: Determines the sensitivity of the pivot detection. Larger values find more significant structural swings, while smaller values find more frequent, minor levels. Historical Buffer Size: Controls how many historical pivots the script stores in memory. A larger buffer allows the script to track older historical levels.
🔹 Display
Number of Points (P): Sets the maximum number of closest levels to display and include in the Volumetric Average calculation. Dot Transparency: Adjusts the visibility of the heatmap dots on the chart. Color Theme: Allows selection between different heatmap palettes (Viridis, Inferno, Magma, Plasma, Cividis, Turbo) to represent volume intensity.
Wskaźnik Pine Script®






















