OPEN-SOURCE SCRIPT
Atualizado

Volume Profile Heatmap [KEYALGOS]

6 413

OVERVIEW
The Volume Profile Heatmap is an advanced market structure tool that visualizes historical volume distribution across price levels using an intuitive color gradient system. Unlike traditional volume profile indicators that display static histograms, this tool creates a dynamic heatmap overlay that instantly reveals high probability support and resistance zones, liquidity clusters, and value areas where institutional activity has occurred.

This indicator is designed for traders who need to identify where significant volume has been transacted, allowing for more informed entry, exit, and risk management decisions based on actual market participation rather than price action alone.


KEY FEATURES AND NOVEL TECHNIQUES
  1. Adaptive Volume Distribution Algorithm: Volume from each candle is intelligently distributed across all price bands it occupied during its formation, ensuring accurate representation even for large range candles
  2. Dynamic Gradient Color Mapping: Each horizontal band automatically adjusts its color intensity based on relative volume concentration, creating an instant visual heatmap from low activity (subtle tones) to high activity (intense tones)
  3. Real Time Value Area Calculation: Uses bidirectional expansion from the Point of Control to dynamically compute Value Area High and Low boundaries based on your selected percentage threshold
  4. Selective Volume Filtering: Analyze bullish volume, bearish volume, or combined volume to understand directional conviction at specific price levels
  5. Optimized Plot Architecture: Engineered to maximize visual information within Pine Script's 64 plot limit, delivering up to 24 distinct volume bands plus reference lines without performance degradation
  6. Responsive Lookback Window: Adjustable calculation period allows you to focus on recent structure or broader historical context based on your trading timeframe


USER MODIFIABLE PARAMETERS

Calculation Settings
  1. Lookback Period
    • Range: 10 to 300 bars
    • Default: 100
    • Purpose: Defines how many historical bars are included in the volume profile calculation
    • Trading Tip: Shorter periods (10-50) work well for intraday scalping, medium periods (50-150) suit swing trading, and longer periods (150-300) help identify major structural levels on higher timeframes
  2. Profile Rows (Max 24)
    • Range: 10 to 24 bands
    • Default: 24
    • Purpose: Controls the vertical resolution of the heatmap by dividing the price range into discrete horizontal bands
    • Trading Tip: Higher row counts provide finer price granularity but may reduce visual clarity on lower timeframes. Start with 24 and reduce if the chart appears cluttered
  3. Value Area Percentage
    • Range: 5% to 95%
    • Default: 68%
    • Purpose: Determines what percentage of total profile volume is included within the Value Area boundaries (VAH/VAL)
    • Trading Tip: 68% approximates one standard deviation in normal distribution and is widely used by institutional traders. Lower values (30-50%) identify core liquidity zones, while higher values (80-95%) show broader acceptance ranges
  4. Volume Type
    • Options: Both, Bullish, Bearish
    • Default: Both
    • Purpose: Filters which candles contribute volume to the profile calculation
    • Trading Tip: Use Bullish only to identify support levels where buying pressure dominated, Bearish only to find resistance where selling pressure was strong, or Both for comprehensive market structure analysis


Color Settings
  1. High Volume Color
    • Default: Red with transparency
    • Purpose: Color applied to bands with the highest relative volume concentration
    • Customization: Click the color picker to select any hue and adjust transparency to suit your chart theme
  2. Low Volume Color
    • Default: Light yellow with high transparency
    • Purpose: Color applied to bands with minimal volume activity
    • Customization: Choose subtle tones that remain visible but do not distract from high volume zones
  3. POC Line Color
    • Default: Orange
    • Purpose: Color of the Point of Control reference line marking the single price level with maximum volume
    • Trading Tip: The POC often acts as a magnet for price and a key decision point for breakouts or reversals
  4. VAH/VAL Lines Color
    • Default: Blue
    • Purpose: Color of the Value Area High and Value Area Low boundary lines
    • Trading Tip: Price reactions at VAH/VAL often signal continuation or rejection of the current value area
  5. Extreme Lines Color
    • Default: Gray
    • Purpose: Color of the profile high and low reference lines marking the boundaries of the lookback range
    • Trading Tip: These levels help contextualize where current price sits relative to the recent trading range


Display Toggles
  1. Show POC
    • Default: Enabled
    • Purpose: Toggles visibility of the Point of Control reference line
  2. Show Value Area Lines
    • Default: Enabled
    • Purpose: Toggles visibility of VAH and VAL boundary lines
  3. Show Profile Extremes
    • Default: Enabled
    • Purpose: Toggles visibility of the highest high and lowest low lines from the lookback period


HOW TO USE THIS INDICATOR
  1. Identify High Probability Zones: Areas colored with intense high volume colors represent price levels where significant trading activity occurred. These zones often act as support or resistance during future price visits
  2. Trade Value Area Breakouts: When price moves decisively above VAH or below VAL with conviction, it may signal the start of a new value area and potential trend continuation
  3. Use POC for Entry Refinement: The Point of Control frequently serves as a fair value reference. Pullbacks to POC in the direction of the trend can offer high reward entry opportunities
  4. Confirm Breakouts with Volume Profile: A breakout that occurs through a low volume node (thin colored band) has higher probability of success than one struggling through a high volume node
  5. Combine with Price Action: Use candlestick patterns, momentum oscillators, or trend filters alongside the heatmap to confluence your trading decisions


TRADING APPLICATIONS
  • Intraday Trading: Set lookback to 50-100 bars on 5-15 minute charts to identify intraday value areas and liquidity pools
  • Swing Trading: Use 100-200 bar lookback on 1H-4H charts to map structural support and resistance for multi day positions
  • Breakout Confirmation: Wait for price to clear high volume nodes before entering breakout trades to avoid false moves
  • Reversal Identification: Sharp rejections at high volume nodes with bearish/bullish volume divergence can signal potential reversals
  • Risk Management: Place stop losses beyond high volume nodes rather than arbitrary price levels, as these zones represent areas of strong market participation


PERFORMANCE AND TECHNICAL NOTES
  1. This indicator is optimized for efficiency and works best with lookback periods under 300 bars
  2. The 24 row maximum ensures compatibility with Pine Script's plot limitations while delivering professional grade resolution
  3. Real time calculations update on each new bar, providing current market structure without repainting historical values
  4. For best performance on lower timeframe charts, consider reducing the Profile Rows setting if you experience rendering delays


SUPPORT AND UPDATES
This indicator is maintained by the KeyAlgos development team. We regularly review user feedback and market evolution to enhance functionality. For feature requests, bug reports, or usage questions, please visit our agency profile page or contact us through TradingView messaging.

Remember: No indicator guarantees profits. Always combine Volume Profile Heatmap analysis with sound risk management, position sizing, and broader market context. Past performance does not guarantee future results.


KeyAlgos - Algorithmic Tools for Discerning Traders
Notas de Lançamento
Volume Profile Heatmap [KEYALGOS] Performance Update

Welcome to the updated version of the Volume Profile Heatmap. This update brings massive performance optimizations, specifically designed to eliminate the execution limit timeouts experienced by users trading high volume traditional markets like Forex and Equities.

Modifications and Performance Upgrades

The core mathematical engine that builds the volume histogram remains exactly the same, preserving the original gradient visuals. However, the internal architecture has been completely rebuilt for maximum efficiency.

Special thanks and credit to Reddit user u/Mess_Hot for providing the architectural framework, caching logic, and defensive programming techniques used to optimize this script.


Here is a detailed breakdown of the technical modifications applied in this version:

  1. Execution Gating: The script no longer recalculates the entire volume profile on every single price tick. Heavy mathematical calculations are now strictly gated to run only when a new bar opens.
  2. State Caching: Using persistent variables, the script now calculates the profile once per bar and caches the results in memory. The visual heatmap is rendered instantly using this lightweight cached data, eliminating rendering lag.
  3. Loop Protection: Added a safety counter to the Value Area calculation loop. This acts as a circuit breaker to prevent infinite loops and indicator crashes during completely flat market conditions or data gaps.
  4. Array Bounds Checking: Added mathematical clamping to ensure that massive, unprecedented price spikes do not cause fatal out of bounds array errors.


User Parameter Guide

Below is a comprehensive explanation of every modifiable option available in the indicator settings menu.

Calculation Settings

  • Lookback Period: Defines the number of historical bars the script will analyze to build the volume profile. A higher number provides a wider macro view, while a lower number focuses on immediate micro trends.
  • Profile Rows (Max 24): Sets the number of vertical bins used to slice the price range. Due to TradingView plotting limits, this must remain at 24 or lower.
  • Value Area Percent: Determines the percentage of total volume to include in the Value Area calculation. The default is 68, representing roughly one standard deviation from the Point of Control.
  • Volume Type: Allows you to filter the specific volume data used to build the profile. You can choose to calculate Both, Bullish only, or Bearish only volume.


Color Settings

  • High Volume Color: Sets the base color and opacity for the zones with the highest trading activity.
  • Low Volume Color: Sets the base color and opacity for the zones with the lowest trading activity. The script automatically calculates a smooth, continuous color gradient between this selection and your High Volume Color.
  • POC Line: Determines the color of the Point of Control line, which marks the highest single volume node.
  • VAH/VAL Lines: Determines the color for the Value Area High and Value Area Low boundary lines.
  • Extreme Lines: Determines the color for the absolute highest and lowest price boundaries of your chosen lookback period.


Visual Settings

  • Show POC: A toggle to display or hide the Point of Control line on your chart.
  • Show Value Area Lines: A toggle to display or hide the Value Area High and Value Area Low boundaries.
  • Show Profile Extremes: A toggle to display or hide the top and bottom edge lines of the calculated profile range.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.