PROTECTED SOURCE SCRIPT
Malama's Heat Map

Overview
Malama's Heat Map is an overlay indicator that visualizes historical liquidity as a dynamic heatmap aligned with the price chart, using volume as a proxy to map activity across time (X-axis) and price levels (Y-axis). It constructs a grid of up to 5000 cells via a matrix, distributing bar volume into discrete price bins to highlight concentration zones, creating a color-graded visualization from cool (low activity) to hot (high liquidity). This aids in identifying "Type II" fair value areas, support/resistance from past volume clusters, or potential imbalances without order book access. Built for v6 compatibility with efficiency in mind—computations run solely on the last bar, includes object limit enforcement, and offers two intra-bar volume distribution methods for flexible approximation.
Core Mechanics
The indicator generates a trailing heatmap through binning, accumulation, and box-based rendering:
Grid Setup: Configurable lookback (bars back, default 100) sets horizontal time span; bins (price divisions, default 50) define vertical resolution, limited to 5000 total cells to prevent errors. Bin height dynamically = max(mintick, (lookback high - low) / bins).
Y-Axis Stabilization: Anchors boundaries to the prior bar's high/low (if available) for a flicker-free view during live bar updates. All historical bar data (high/low/close/volume) is clipped to these bounds.
Volume Distribution Proxy:
Even: Divides bar volume equally across spanned bins (straightforward uniform spread).
POC Weighted (Inverse): Treats bar close as POC proxy; applies inverse distance weighting (1/(|bin - POC bin| + 1), normalized) to emphasize volume near the estimated control point, simulating clustered intra-bar trading.
Matrix Building: On last bar only, loops backward over lookback bars (newest right-aligned). For each, computes low/high bin indices, distributes volume per selected method into the matrix (columns=time, rows=price bins from low to high).
Scaling & Palette: Extracts max matrix value for relative normalization (0-1); maps to a 5-tier stepped color scheme (user-customizable: blue 90% transp. low → red 50% transp. high) for non-linear intensity.
Rendering: Clears old boxes, then iterates matrix to draw only non-zero cells as thin boxes: X spans one bar width (left=historical index from bar_index, right=next bar), Y fills bin height. Borderless for seamless heatmap effect.
The result is a right-leaning, chart-scrolling visualization emphasizing recent liquidity buildup.
Why This Adds Value & Originality
While session-based volume profiles exist, this heatmap captures ongoing multi-bar liquidity evolution ("Type II" style), revealing horizontal value areas or gaps dynamically. Originality shines in the custom inverse-weighting for POC realism (no ta.* dependencies), matrix-driven persistence for quick redraws, and stabilization to eliminate repaints—issues plaguing similar scripts. v6 adaptations (e.g., custom clamp, matrix recreation on input change) ensure broad compatibility without bloat. It condenses complex liquidity scanning into one tool: spot red "hot" bands as magnets, blue voids as FVGs. Unlike generic heatmaps, the proxy options and limit-aware design scale across timeframes/assets (e.g., forex vs. crypto), reducing the need for layered indicators.
How to Use
Setup: Apply as overlay. Defaults suit ~4-day 1H view; tune lookback/bins (e.g., 50x100 for intraday fine-detail, but watch 5000 cap—errors auto-flag excesses). Select "POC Weighted" for nuanced clustering, "Even" for simplicity. Customize palette (e.g., desaturate for dark themes).
Reading the Heatmap:
X-Axis (Time): Left=older (fainter context), right=recent focus; tracks evolving liquidity trails.
Y-Axis (Price): Bottom=range low, top=high; vertical density shows price-level attraction.
Colors: Faint blue (sparse volume, possible inefficiencies) → vivid red (dense activity, likely SR). Horizontal streaks = sustained value zones.
Trading Insights: Price wicking into red? Anticipate fills/reversals. Blue gaps post-break? Targets for retraces. Ideal on 5M–Daily; layer with candlesticks off for purity.
Example: In BTCUSD 4H, a yellow-red band at $60K from prior consolidation → treat as dynamic support for longs on dips.
Tips
Balance settings: High bins = sharper verticals but cap lookback (e.g., 80x60=4800 cells). Test on volatile pairs first.
"POC Weighted" excels in ranging markets; switch to "Even" for trending (avoids close-bias skew).
For deeper analysis, screenshot/export or pair with divergence tools; add manual alerts via box counts if extended.
Efficiency: Last-bar only keeps it snappy; refresh on input tweaks.
Limitations & Disclaimer
Visualization is historical/proxy-based—lagging by one bar, no forward projection or tick-level precision (close-as-POC is estimate). Clipping may trim outlier wicks; low-volume bars dilute globally. Stepped colors are relative (max scales per redraw), potentially compressing extremes. Exceeds 5000 cells? Runtime error halts—no fallback resize. Not real liquidity (volume ≠ depth); best as visual aid, not quantitative. Updates post-close only. Backtest zones on specific symbols—correlation ≠ causation. Not advice; trade responsibly. Ideas in comments!
Malama's Heat Map is an overlay indicator that visualizes historical liquidity as a dynamic heatmap aligned with the price chart, using volume as a proxy to map activity across time (X-axis) and price levels (Y-axis). It constructs a grid of up to 5000 cells via a matrix, distributing bar volume into discrete price bins to highlight concentration zones, creating a color-graded visualization from cool (low activity) to hot (high liquidity). This aids in identifying "Type II" fair value areas, support/resistance from past volume clusters, or potential imbalances without order book access. Built for v6 compatibility with efficiency in mind—computations run solely on the last bar, includes object limit enforcement, and offers two intra-bar volume distribution methods for flexible approximation.
Core Mechanics
The indicator generates a trailing heatmap through binning, accumulation, and box-based rendering:
Grid Setup: Configurable lookback (bars back, default 100) sets horizontal time span; bins (price divisions, default 50) define vertical resolution, limited to 5000 total cells to prevent errors. Bin height dynamically = max(mintick, (lookback high - low) / bins).
Y-Axis Stabilization: Anchors boundaries to the prior bar's high/low (if available) for a flicker-free view during live bar updates. All historical bar data (high/low/close/volume) is clipped to these bounds.
Volume Distribution Proxy:
Even: Divides bar volume equally across spanned bins (straightforward uniform spread).
POC Weighted (Inverse): Treats bar close as POC proxy; applies inverse distance weighting (1/(|bin - POC bin| + 1), normalized) to emphasize volume near the estimated control point, simulating clustered intra-bar trading.
Matrix Building: On last bar only, loops backward over lookback bars (newest right-aligned). For each, computes low/high bin indices, distributes volume per selected method into the matrix (columns=time, rows=price bins from low to high).
Scaling & Palette: Extracts max matrix value for relative normalization (0-1); maps to a 5-tier stepped color scheme (user-customizable: blue 90% transp. low → red 50% transp. high) for non-linear intensity.
Rendering: Clears old boxes, then iterates matrix to draw only non-zero cells as thin boxes: X spans one bar width (left=historical index from bar_index, right=next bar), Y fills bin height. Borderless for seamless heatmap effect.
The result is a right-leaning, chart-scrolling visualization emphasizing recent liquidity buildup.
Why This Adds Value & Originality
While session-based volume profiles exist, this heatmap captures ongoing multi-bar liquidity evolution ("Type II" style), revealing horizontal value areas or gaps dynamically. Originality shines in the custom inverse-weighting for POC realism (no ta.* dependencies), matrix-driven persistence for quick redraws, and stabilization to eliminate repaints—issues plaguing similar scripts. v6 adaptations (e.g., custom clamp, matrix recreation on input change) ensure broad compatibility without bloat. It condenses complex liquidity scanning into one tool: spot red "hot" bands as magnets, blue voids as FVGs. Unlike generic heatmaps, the proxy options and limit-aware design scale across timeframes/assets (e.g., forex vs. crypto), reducing the need for layered indicators.
How to Use
Setup: Apply as overlay. Defaults suit ~4-day 1H view; tune lookback/bins (e.g., 50x100 for intraday fine-detail, but watch 5000 cap—errors auto-flag excesses). Select "POC Weighted" for nuanced clustering, "Even" for simplicity. Customize palette (e.g., desaturate for dark themes).
Reading the Heatmap:
X-Axis (Time): Left=older (fainter context), right=recent focus; tracks evolving liquidity trails.
Y-Axis (Price): Bottom=range low, top=high; vertical density shows price-level attraction.
Colors: Faint blue (sparse volume, possible inefficiencies) → vivid red (dense activity, likely SR). Horizontal streaks = sustained value zones.
Trading Insights: Price wicking into red? Anticipate fills/reversals. Blue gaps post-break? Targets for retraces. Ideal on 5M–Daily; layer with candlesticks off for purity.
Example: In BTCUSD 4H, a yellow-red band at $60K from prior consolidation → treat as dynamic support for longs on dips.
Tips
Balance settings: High bins = sharper verticals but cap lookback (e.g., 80x60=4800 cells). Test on volatile pairs first.
"POC Weighted" excels in ranging markets; switch to "Even" for trending (avoids close-bias skew).
For deeper analysis, screenshot/export or pair with divergence tools; add manual alerts via box counts if extended.
Efficiency: Last-bar only keeps it snappy; refresh on input tweaks.
Limitations & Disclaimer
Visualization is historical/proxy-based—lagging by one bar, no forward projection or tick-level precision (close-as-POC is estimate). Clipping may trim outlier wicks; low-volume bars dilute globally. Stepped colors are relative (max scales per redraw), potentially compressing extremes. Exceeds 5000 cells? Runtime error halts—no fallback resize. Not real liquidity (volume ≠ depth); best as visual aid, not quantitative. Updates post-close only. Backtest zones on specific symbols—correlation ≠ causation. Not advice; trade responsibly. Ideas in comments!
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。