OPEN-SOURCE SCRIPT

Liquidity Heatmap Matrix [MTF] - PhenLabs

396
๐Ÿ“ŠLiquidity Heatmap Matrix [MTF] [PhenLabs]
Version: PineScriptโ„ขv6

cuplikan

๐Ÿ“ŒDescription

The Liquidity Heatmap Matrix [MTF] is a multi-timeframe liquidity detection and visualization tool built to identify where equal highs and equal lows are forming across up to five configurable timeframes. It solves a core challenge for smart money and ICT-style traders: knowing exactly where stop-loss clusters and liquidity pools are building โ€” before price sweeps them.

Rather than manually scanning multiple timeframes for double tops and bottoms, this indicator automates the entire process and presents confluence-weighted liquidity zones as a heatmap overlay directly on your chart. Levels confirmed by more timeframes glow with greater intensity, giving you an immediate sense of which zones carry the highest probability of a liquidity grab.

When price sweeps through a detected level, the indicator confirms it in real time with on-chart labels, color changes, and optional alerts โ€” turning reactive analysis into proactive trade planning.

๐Ÿš€Points of Innovation

โ— First-of-its-kind heatmap approach that scores liquidity zones on a 1-to-5 confluence scale across independent timeframes
โ— Automatic merging of nearby equal levels using a percentage-based tolerance system, eliminating duplicate zone clutter
โ— Real-time sweep confirmation engine that detects when price pierces a level and closes back inside, validating the liquidity grab
โ— Dynamic zone coloring that shifts from transparent to fully opaque as more timeframes confirm the same price level
โ— Built-in dashboard that ranks all active levels by confluence strength and tracks bullish versus bearish sweep counts
โ— Comprehensive alert suite covering new equal high/low formation and sweep events for both directions

๐Ÿ”งCore Components

โ— Multi-Timeframe Pivot Engine: Runs pivot high/low detection independently on each of the five timeframes using request.security calls, then feeds results into a unified level registry
โ— Equal Level Comparator: Compares each new pivot against a rolling window of recent pivots using a configurable percentage tolerance to identify price levels that have been tested more than once
โ— Confluence Merger: When the same price level appears on multiple timeframes, the system merges them into a single zone and increments the confluence score rather than stacking overlapping boxes
โ— Sweep Detection Module: Monitors all active levels bar-by-bar, confirming a sweep when price breaches the zone edge and then closes back within it โ€” filtering out false breakouts
โ— Heatmap Renderer: Translates each levelโ€™s confluence score into a color intensity gradient, with separate palettes for equal highs (red spectrum) and equal lows (green spectrum)
โ— Dashboard Table: Displays every active level in a sortable table with type, price, per-timeframe dot indicators, confluence rating, and sweep status

๐Ÿ”ฅKey Features

โ— Supports 5 fully independent timeframes that can be toggled on or off and set to any interval from 1 minute to Monthly
โ— Heatmap coloring intensity scales automatically with confluence count โ€” single-timeframe levels appear faint while 5-TF levels are fully saturated
โ— Sweep labels display the direction, confluence count, confirming timeframes, and exact price of each swept level directly on the chart
โ— Dashboard tracks all active equal high and equal low levels sorted by confluence descending with real-time bull and bear sweep counters
โ— Four alert conditions cover new equal highs, new equal lows, bearish sweeps (EQH taken), and bullish sweeps (EQL taken)
โ— Swept zones automatically change to a distinct highlight color and freeze their right edge at the sweep bar for clear historical reference
โ— Old swept levels are cleaned up after 100 bars and stale unswept levels expire after 500 bars to keep the chart uncluttered
โ— All zone colors, widths, extension lengths, and dashboard positioning are fully customizable

๐ŸŽจVisualization

โ— Liquidity Zone Boxes: Colored rectangles overlaid on the chart representing each equal high or equal low level โ€” red-spectrum for EQH, green-spectrum for EQL, with opacity increasing as confluence rises
โ— Heatmap Intensity Gradient: Single-TF zones appear nearly transparent while 5-TF zones are fully opaque, creating a visual heat signature of where liquidity is densest
โ— Sweep Labels: Appear at the sweep bar with directional arrows (๐Ÿ”ป for EQH swept, ๐Ÿ”บ for EQL swept), showing confluence count, confirming timeframe list, and price
โ— Swept Zone Highlight: Confirmed sweeps turn the zone box to a yellow highlight color, clearly distinguishing consumed liquidity from active levels
โ— Dashboard Table: A compact on-chart table (repositionable to any corner) showing Type, Price, per-TF active dots (โ— / โ—‹), and confluence rating for every tracked level
โ— Summary Footer: Bottom row of the dashboard displays total bullish sweeps, bearish sweeps, and combined sweep count

๐Ÿ“–Usage Guidelines

โ— TF 1 through TF 5 Enabled โ€” Toggle each timeframe on or off (Default: TF1 and TF2 enabled, TF3-TF5 disabled)
โ— TF 1 through TF 5 Interval โ€” Set each timeframe independently (Defaults: 5m, 15m, 1H, 4H, Daily)
โ— Pivot Lookback Left โ€” Number of bars to the left for pivot detection (Default: 6, Range: 1โ€“50)
โ— Pivot Lookback Right โ€” Number of bars to the right for pivot confirmation (Default: 6, Range: 1โ€“50)
โ— Equal Level Tolerance (%) โ€” Maximum percentage difference for two pivots to be considered equal (Default: 0.1%, Range: 0.01โ€“2.0%)
โ— Max Pivots to Compare โ€” Rolling window size of recent pivots checked for equal levels (Default: 5, Range: 2โ€“10)
โ— Max Active Levels โ€” Maximum number of liquidity zones tracked simultaneously (Default: 20, Range: 5โ€“50)
โ— Sweep Confirm Bars โ€” Bars to wait before confirming a sweep after price pierces a level (Default: 2, Range: 1โ€“10)
โ— Show Liquidity Zones โ€” Toggle zone box rendering on or off (Default: On)
โ— Show Sweep Labels โ€” Toggle sweep confirmation labels on or off (Default: On)
โ— Show Dashboard โ€” Toggle the summary dashboard table on or off (Default: On)
โ— Zone Width (%) โ€” Percentage-based half-width of each liquidity zone box (Default: 0.05%, Range: 0.01โ€“1.0%)
โ— Zone Extend (bars) โ€” How far forward active zone boxes extend on the chart (Default: 50, Range: 10โ€“200)
โ— Dashboard Position โ€” Corner placement of the dashboard table (Options: Top Right, Bottom Right, Top Left, Bottom Left)
โ— EQH Colors โ€” Customizable color range from 1-TF to 5-TF confluence for equal high zones (Default: Red spectrum with varying transparency)
โ— EQL Colors โ€” Customizable color range from 1-TF to 5-TF confluence for equal low zones (Default: Green spectrum with varying transparency)
โ— Swept Zone Color โ€” Highlight color for levels that have been confirmed swept (Default: Yellow at 30% transparency)

โœ…Best Use Cases

โ— Identifying high-probability reversal zones where liquidity has clustered across multiple timeframes before entering a mean-reversion trade
โ— Pre-planning take-profit targets by locating where dense liquidity pools sit above or below current price
โ— Filtering breakout trades by checking whether price is approaching a high-confluence liquidity zone likely to cause a sweep and reversal
โ— Confirming ICT and smart money concepts by visualizing where equal highs and equal lows form as institutional liquidity targets
โ— Setting up sweep-based alerts to get notified the moment a multi-TF liquidity level gets taken, enabling rapid reaction entries
โ— Using the dashboard as a real-time liquidity scoreboard during active trading sessions to track which levels remain live and which have been consumed

โš ๏ธLimitations

โ— Pivot detection requires a right-side lookback, so level identification has an inherent delay equal to the Pivot Lookback Right setting
โ— Very low tolerance values on volatile assets may produce few matches, while very high values may create false confluences โ€” tuning to the assetโ€™s typical spread is recommended
โ— The indicator tracks up to the Max Active Levels limit, so on extremely active charts some older unswept levels may be pruned before they are reached
โ— Multi-timeframe security calls can increase chart loading time, especially when all five timeframes are enabled on lower-timeframe charts
โ— Sweep detection relies on close price returning inside the zone โ€” wicks that pierce and immediately reverse on the same bar without closing inside may not be captured
โ— This tool identifies liquidity zones and sweeps but does not generate buy or sell signals โ€” it is designed to complement your existing strategy, not replace it

๐Ÿ’กWhat Makes This Unique

โ— Confluence-weighted heatmap visualization is a fundamentally different approach to liquidity mapping compared to simple equal-high/low markers, providing probabilistic weight to each level
โ— The automatic cross-timeframe merging system eliminates zone stacking and clutter that plagues most multi-timeframe indicators
โ— Real-time sweep confirmation with multi-bar validation filters out noise and false breakouts that single-bar detection methods frequently flag
โ— The integrated dashboard provides a full-spectrum situational awareness panel without needing to switch between timeframes or use multiple indicators

๐Ÿ”ฌHow It Works

โ— Step 1 โ€” Pivot Detection: On each enabled timeframe, the script independently identifies pivot highs and pivot lows using a configurable left/right lookback window via ta.pivothigh and ta.pivotlow functions
โ— Step 2 โ€” Equal Level Matching: Each new pivot is compared against a rolling buffer of recent pivots on the same timeframe; if two pivots fall within the percentage tolerance, an equal high or equal low is flagged
โ— Step 3 โ€” Cross-Timeframe Registration and Merging: Detected equal levels are registered into a central level array; if a level from one timeframe falls near an existing level, it merges by incrementing the confluence score rather than creating a duplicate
โ— Step 4 โ€” Heatmap Rendering: Each active level is drawn as a zone box with color intensity mapped to its confluence score using a 5-tier gradient โ€” more confirming timeframes produce more visually prominent zones
โ— Step 5 โ€” Sweep Monitoring: Every bar, the script checks whether price has breached a zone edge and closed back inside, confirming a liquidity sweep; confirmed sweeps update the zone color, freeze the box, and generate labels and alerts
โ— Step 6 โ€” Lifecycle Management: Swept levels are retained for 100 bars for historical reference then removed; unswept levels older than 500 bars are pruned to maintain chart performance and visual clarity

๐Ÿ’กNote:
For best results, start with the default settings and adjust tolerance and pivot lookback values to match the volatility profile of your specific asset. Lower timeframe combinations (e.g., 5m + 15m) are ideal for intraday scalping, while higher timeframe setups (e.g., 1H + 4H + Daily) suit swing trading. This indicator is designed as a confluence tool โ€” combine it with your existing strategy, order flow analysis, or market structure methodology for highest-probability trade setups. It does not produce buy or sell signals on its own.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.