OPEN-SOURCE SCRIPT

Strata Volume Contour [JOAT]

1 187
Strata Volume Contour [JOAT]

Introduction

Strata Volume Contour (SVC) is an open-source dynamic volume profile engine that divides a configurable lookback window into 25 equidistant price bins and accumulates the total traded volume within each bin. The result is a real-time horizontal histogram drawn to the right of the current bar, showing exactly where the market has spent the most volume over the selected period. The Point of Control (POC) — the highest-volume bin — is highlighted as the dominant fair-value level. The Value Area — the range of bins containing 70% of total volume — is shaded to mark the institutional accumulation zone.

The problem SVC solves is the inability of time-based charts to show volume distribution across price levels. Standard volume bars show how much was traded each period, but not at which prices. Volume profile reveals the price levels that attracted the most participation — these are the levels where institutional orders were concentrated, making them the most meaningful support and resistance references available. SVC brings this institutional-grade analysis directly to the chart without requiring specialized volume profile software.

снимок

Core Concepts

1. Price Range Binning

The indicator determines the highest high and lowest low across the full lookback window, then divides this range into 25 equal-width bins. Each bin represents a price zone:

Pine Script®


A zero-range guard (binStep > 0) prevents division errors on flat or illiquid instruments. With 25 bins, the histogram provides enough granularity to identify structural features while remaining visually clean.

2. Volume Accumulation (Performance-Gated)

Volume accumulation runs exclusively on the last bar of the chart (barstate.islast). This is a critical design decision: running the O(bins x lookback) double-loop on every bar within the lookback window would create an O(bars x bins x lookback) computational cost that exceeds TradingView's execution limits on longer charts. By gating to the last bar, the full recalculation costs O(bins x lookback) exactly once per chart update:

Pine Script®


Each bar within the lookback is assigned to the nearest bin based on its closing price.

3. Point of Control (POC)

The POC is the bin with the highest accumulated volume. It represents the price level where the most trading activity occurred over the lookback period. Markets tend to use the POC as a magnet — price is attracted to it during consolidation and uses it as a reference when transitioning between ranges. The POC is rendered with a distinct highlight color (default orange) to make it immediately identifiable.

4. Value Area Calculation (70% Rule)

The Value Area is determined by a symmetric expansion algorithm. Starting from the POC, the algorithm expands outward one bin at a time, always adding the bin (above or below) that contributes the most volume, until the accumulated volume within the expanding range reaches 70% of total volume:

Pine Script®


The Value Area High (VAH) and Value Area Low (VAL) define the institutional accumulation zone. Price outside the value area represents a premium (above) or discount (below) relative to the lookback period's fair value.

5. Horizontal Histogram Visualization

Each bin is drawn as a horizontal box extending rightward from the current bar. The box width is proportional to the bin's volume relative to the POC volume — the POC spans the maximum width (50 bars right), and all other bins scale proportionally. Volume amounts are labeled on each bar.

Features

  • 25-Bin Volume Profile Histogram: Full horizontal volume distribution rendered to the right of price with proportional bar widths and volume labels
  • Point of Control (POC): Highest-volume bin highlighted in a distinct color (default orange) with automatic detection each bar update
  • Value Area (VAH / VAL): The 70%-volume range shaded in a distinct color, with Value Area High and Low explicitly tracked and displayed in the dashboard
  • Gradient Bin Coloring: Each non-POC, non-VA bin is colored on a gradient from low volume (nearly transparent) to high volume (full opacity), creating a visual density map
  • Static Level Plots: All 25 bin levels are plotted as horizontal lines over the lookback window, providing a persistent price level grid even without the boxes visible
  • Price vs POC Context: The dashboard reports whether price is currently Above POC, Below POC, or At POC
  • 8-Row Dashboard (Top Right): POC price, VA High, VA Low, price vs POC relationship, total volume, lookback period, and version
  • Watermark: JackOfAllTrades signature at chart center-bottom


Input Parameters

Profile Settings:
  • Lookback Period: Number of bars to include in the volume accumulation (default: 200, range: 50-500)


Visual Settings:
  • Show Volume Bins: Toggle the horizontal histogram boxes
  • Bin Color: Base color for the bin gradient (default: blue)
  • Bin Width: Border width of histogram boxes (default: 1, range: 0-5)
  • Highlight POC: Toggle POC highlighting
  • POC Color: Color for the highest-volume bin (default: orange)
  • Show Value Area: Toggle the 70%-volume range shading
  • VA High Color: Color for the Value Area High reference
  • VA Low Color: Color for the Value Area Low reference
  • Theme: Auto, Dark, or Light


How to Use This Indicator

Step 1: Identify the Point of Control
The POC is the most important level on the profile. It is the price the market spent the most time trading at — the ultimate fair-value anchor. Price below the POC is at a discount; above is at a premium. Trading setups at the POC during retest often exhibit tight risk/reward.

Step 2: Use Value Area Boundaries for Support and Resistance
The Value Area High and Low are the primary structural boundaries. Price often oscillates within the value area and struggles when attempting to leave it. A close outside the value area with high volume often signals the beginning of a new directional move.

Step 3: Adjust Lookback to Your Trading Style
Shorter lookbacks (50-100 bars) produce a profile of recent price structure, relevant for intraday traders. Longer lookbacks (300-500 bars) produce a macro structural view, relevant for swing traders. The POC and value area boundaries shift as the lookback changes.

Step 4: Watch Price Return to the POC
After price moves away from the POC, it frequently returns to it during low-volume periods. When price is far from the POC and trending, the POC can serve as a magnet target for reversion. When price is oscillating around the POC, it reflects a balanced, two-sided auction.

снимок

Indicator Limitations

  • The profile recalculates only on barstate.islast — it reflects the state at the last confirmed bar. During real-time market hours, the profile is not updating tick-by-tick; it updates each time a bar closes
  • The volume accumulation assigns each bar to a bin based on closing price, not the intrabar high-low range. This is a simplification — a professional volume profile distributes volume across all prices touched during the bar. The close-based method is computationally feasible within Pine Script's constraints
  • The 25-bin resolution is fixed. Very large price ranges (e.g., a lookback spanning a major crash) may produce bins too wide to be structurally meaningful. Users should adjust the lookback to keep the range within a reasonable structural period
  • Instruments with no volume data (some indices, spot forex) will show all zero bins and the profile will not render meaningfully
  • The histogram boxes are drawn to the right of the current bar. On instruments with extended right-side padding disabled, the boxes may be partially hidden off-chart


Originality Statement

SVC is original in its approach to making volume profile accessible within Pine Script's performance constraints. This indicator is published because:

  • The barstate.islast performance gate is the key design innovation — it collapses what would otherwise be an O(bars x bins x lookback) computation into a single O(bins x lookback) pass, making a 25-bin volume profile with 500-bar lookback feasible within TradingView's execution limits
  • The 70% Value Area algorithm uses a symmetric expansion approach (always adding the larger of the next bin up or down) that correctly implements the standard Volume Profile Value Area methodology
  • The gradient bin coloring uses color.from_gradient() against the POC volume as the maximum reference, making the visual density map adaptive to the actual volume distribution rather than a fixed scale
  • The Price vs POC contextual label in the dashboard provides an immediately actionable market context read without requiring the user to visually judge their position relative to the histogram


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Volume profile levels are based on historical volume distribution and represent areas of past interest, not guarantees of future price behavior. The Point of Control and Value Area boundaries can and do shift significantly as the lookback window evolves. Always use proper risk management. The author is not responsible for any trading losses resulting from the use of this indicator.

-Made with passion by jackofalltrades

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.