OPEN-SOURCE SCRIPT
更新済

Liquidation Heatmap by Rumiancev

5 621
Liquidation Heatmap by Rumiancev

スナップショット

Overview
Liquidation Heatmap is an open-source visual map of estimated liquidation zones built from activity spikes.
When the script detects an unusually large spike, it projects liquidation levels for multiple leverage tiers and aggregates them into horizontal price “bins”. Each bin accumulates weight over time and is displayed as a color gradient:
Brighter / hotter = higher accumulated weight
Darker / colder = lower accumulated weight

Important: This is not an exchange liquidation feed and it does not display “real liquidation prices”. It is a proxy model designed to visualize where liquidation pressure could be clustering based on abnormal market activity.

Why BTCUSDT.P is recommended
For the most consistent and “liquidation-relevant” behavior, use a perpetual futures symbol such as BTCUSDT.P.
Perpetual markets provide Open Interest, so the script can use OI Delta (change in OI) as the spike stream. OI delta typically reflects leveraged positioning changes (build-up / flushes) more directly than spot volume.

• On perpetuals → OI data is available → spikes are usually cleaner for this model
• On spot → OI is not available → the script may fall back to volume, which can be noisier

If needed, set OI Symbol Override manually (examples are shown in the input tooltip).

スナップショット

How it works (logic)
1) Select a spike stream
AUTO: uses OI Delta if available, otherwise Volume
OI: forces OI Delta
VOL: forces Volume only

2) Detect spike events
The script measures abnormal activity using a Z-score style approach on the absolute stream:
Spike Lookback defines the baseline window
Sensitivity maps to a threshold (lower = more events, higher = fewer events)
Min bars between events optionally reduces clustering on lower timeframes

3) Project liquidation prices
For each spike event, liquidation estimates are calculated for up to three leverage tiers:
• Long liquidations are projected below the reference price
• Short liquidations are projected above the reference price

4) Bin, accumulate, and colorize
Projected levels are snapped into bins using Bin Scale (ticks).
Bin weight is accumulated and displayed as a gradient between Low density and High density.

5) Freeze on touch
When price touches a bin (wick or close, depending on settings), the bin is frozen:
• it stops updating
• it becomes dotted / high transparency
This keeps a lightweight history of zones that have been interacted with.

How to read the map
• Bins below price often represent potential long-liquidation pressure zones
• Bins above price often represent potential short-liquidation pressure zones
Brighter bins = more accumulated spike weight → potentially more crowded zone
Frozen dotted bins = price already touched that zone (historical interaction)

Timeframes (recommendations)
This indicator runs on any timeframe, but density/noise changes significantly.

Best balance (recommended):
15m / 1H / 4H — good signal-to-noise and clean structure

Higher timeframes (cleaner, fewer zones):
12H / 1D — fewer events, more “macro” zones

Lower timeframes (noisier by nature):
1m / 3m / 5m — more spikes and more bins
To reduce clutter on low TF, consider:
• increasing Sensitivity (e.g., 14–18)
• enabling Min bars between events (e.g., 10–30)
• increasing Bin Scale (ticks) (thicker bins → fewer levels)
• enabling Keep only local range bins

Inputs (what each setting does)
Source
Source Mode: AUTO / VOL / OI
OI Symbol Override: manual OI source if AUTO is not suitable

Event (Spike) Filter
Spike Lookback: baseline window for mean/stdev
Sensitivity: lower = more events, higher = fewer events
Use high/low for touch test: wick-based touches
Min bars between events: reduces spike clustering

Liquidation Levels (bins)
Reference Price: base price for projections (close/hl2/etc.)
Leverage 1/2/3: leverage tiers (set to 0 to disable any tier)
Bin Scale (ticks): bin thickness (bigger = fewer bins)
Extend (bars): how long active bins extend
Max active bins per side: cap for active bins
Dispersion (%): splits part of the weight to the opposite side
Keep only local range bins + Local range lookback: trims bins far from recent range

Visual
• Gradient colors, frozen transparency, legend, and debug marker

Limitations / Disclaimer
This script is provided for research and educational purposes only. It is not financial advice.
The plotted zones are estimates derived from a simplified model (spike detection + leverage projections). Results depend on symbol, exchange data availability (OI), and timeframe.

リリースノート
This script is an upgraded version of the original liquidation heatmap idea.

The goal of the indicator is to highlight potential liquidation pressure zones by detecting abnormal market activity and mapping that activity into estimated liquidation bands above and below price.

It is important to be clear: this is an estimation model, not an exchange-native liquidation feed.
It does not know the real positions of all traders. Instead, it approximates where leveraged pressure is likely to accumulate based on price, volume, and open interest behavior.

What this indicator does

The script:

detects abnormal participation spikes using Volume or Open Interest delta
assigns that flow to likely long-side or short-side pressure
projects estimated liquidation levels for selected leverage values
groups those levels into price bins
visualizes them as a heatmap directly on the chart
freezes zones once they are touched, so past interactions remain visible
What was improved in this version
1. Stable bin logic

The original idea can become unreliable when price bins are tracked with floating-point values.

This version replaces float-based bin keys with integer bin IDs, which makes bin matching much more stable and prevents fragmented zone accumulation caused by float precision issues.

2. Better Open Interest interpretation

The improved version does not treat OI delta as just absolute size.

It now distinguishes between:

price rising + OI rising
price falling + OI rising
price rising + OI falling
price falling + OI falling

This makes the attribution of likely long pressure vs short pressure more realistic.

In other words, the model now tries to separate:

new positioning
position reduction
possible short covering
possible long unwinding

instead of just reacting to raw magnitude.

3. OI / Volume fallback logic

The script can work in:

AUTO
VOL
OI

modes.

In AUTO mode it uses OI delta when an OI symbol is available, otherwise it falls back to volume automatically.

This makes the indicator usable across more markets and symbols.

4. Better spike detection

The script supports multiple spike-detection approaches:

Z-Score
EMA Z-Score
Average Multiple

This gives more control over how participation spikes are defined and lets the user adapt the model to different market conditions.

5. Weight normalization

Raw volume and raw OI delta behave very differently.

This version adds normalization modes so the heatmap can be made more consistent across instruments and regimes:

Raw
Relative to Average
Positive Z-Score
6. More efficient updates

Instead of recalculating and repainting everything unnecessarily on every bar, the script tracks when arrays actually changed and only refreshes visuals when needed.

This makes the indicator cleaner and more efficient.

7. Better eviction logic

When storage is full, the script can now decide which active zone to remove using different strategies:

Oldest
Weakest
Farthest

This is more flexible than blindly deleting the earliest zone.

8. Better local trimming

If local-range filtering is enabled, zones are now removed more correctly based on the actual zone boundaries, not just a single reference value.

9. Clearer visual state management

Zones remain active while they are relevant.
When price reaches them, they are frozen visually so traders can still see where a reaction occurred.

This preserves chart context instead of simply deleting the evidence.

Core idea behind the model

The indicator assumes that when a strong participation spike occurs, it likely represents a burst of leveraged activity.
That activity is then mapped into estimated liquidation zones for the selected leverage levels.

Long liquidation pressure is projected below the reference price.
Short liquidation pressure is projected above the reference price.

The heatmap density reflects the accumulated estimated pressure in those bins.

Again, these are estimated stress zones, not exact liquidation prints from an exchange engine.

Why this version is better

Compared to a simpler liquidation map, this version is:

more stable technically
more realistic in how it interprets OI
more configurable
less fragile
easier to extend further

It is still an approximation model, but it is a much stronger and more reliable framework for visualizing potential liquidation pressure.

Recommended usage

This indicator works best as a context tool, not as a standalone entry system.

It can be combined with:

trend structure
support and resistance
ATR
volume profile
OI-based tools
breakout/liquidity models

Good use cases:

spotting nearby stress zones
identifying likely liquidity magnets
tracking where price may react after aggressive participation spikes
filtering trend continuation vs exhaustion areas
Notes
This script does not provide exact liquidation data from exchanges.
It is an estimated model based on public chart data.
Results depend on the quality and availability of the OI feed.
If no valid OI symbol is available, volume can still be used as a fallback.
One-line version for publish page

An improved liquidation heatmap that uses Volume or Open Interest delta to estimate leveraged pressure zones and visualize likely liquidation bands across multiple leverage levels.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。