Skip to main content
On this page

Volume Profile in Pine Script: Data, Bins, and Validation

· 5 min read
Pineify Team
Pine Script and AI trading workflow research team

A volume profile groups volume by price over a chosen window. In a custom Pine Script implementation, the result depends on the source data, row boundaries, and how bar volume is allocated. Defining those choices is more useful than presenting a profile as exact trade-by-trade information or guaranteed support and resistance.

Pineify | Best Pine Script Editor

Read the levels as a distribution​

The point of control (POC) is the highest-volume price row. Value-area high and low bound a selected share of the distribution, often using a 70% setting. A wider row can combine nearby activity that a narrower row separates, so the POC may change when the resolution changes.

These levels summarize the selected history. They do not reveal a participant's identity, remaining inventory, or future willingness to trade. Treat a revisit or breakout as a hypothesis with a defined outcome, not a reaction that must occur.

TradingView's volume-profile guide explains its use of lower-timeframe data and directional up/down volume. Its volume type depends on the instrument and feed; a price-update count is not the same unit as exchange-traded shares or contracts.

Specify the calculation before choosing a data structure​

DecisionWhat to document
WindowFixed timestamps, rolling bars, visible range, or named session
DataSymbol, lower timeframe, volume type, and available history
RowsPrice origin, tick-aligned width, and boundary convention
AllocationHow one source bar's volume is distributed among rows
POCTie-breaking when multiple rows have equal volume
Value areaTarget percentage and row-expansion method
UpdatesDeveloping profile or a frozen completed profile

request.security_lower_tf() returns arrays of lower-timeframe values. It does not recover every transaction from ordinary intrabar OHLCV data. If a one-minute bar spans several price rows, its OHLCV values alone do not tell you the exact volume traded at each price inside that bar. See the Pine data-request documentation.

A close-bin method assigns the entire bar's volume to its closing-price row. A range-allocation method distributes it under a stated assumption. These are different approximations, and neither should be labeled exact without supporting data. State which one your implementation uses.

Maps and arrays store accumulated values; changing the container does not create more granular source data. Compare performance with the Pine Profiler on the actual implementation before claiming that one structure is faster.

Use conservation checks​

For a hypothetical three-row example, suppose the allocated volumes are 100, 300, and 200 units. The total is 600 and the middle row is the POC. Those values illustrate an arithmetic check, not a market result.

For each window, compare the sum of row allocations with the source volume included in that window. Investigate discrepancies caused by dropped data, overlapping boundaries, or double-counted intrabars. Define what happens when a source bar crosses the start or end of your selected period.

A value-area calculation needs more than a percentage label. Different expansion and tie-breaking rules can produce different boundaries on the same distribution. Record the algorithm and test it on a small hand-checkable example before interpreting a chart.

Sessions are a choice, not contamination​

A regular-session profile and a full-session profile answer different questions. Overnight activity is not inherently bad data. Specify the session, exchange timezone, and reset condition, then verify the first and last included bars.

When a strategy uses yesterday's completed profile, freeze those levels at the correct boundary. Do not calculate a full day's final distribution and then apply it to decisions made earlier that same day. A developing profile legitimately changes as new volume arrives; a frozen historical reference should not silently absorb later data.

Compare with a built-in profile carefully​

Align the symbol, session, time window, row settings, and chart type first. If your custom implementation uses a different lower timeframe or allocation method, a mismatch can be expected rather than evidence of a bug in either tool. Nonstandard charts can alter the price and volume representation; standard candles simplify an initial comparison.

Inspect totals and a few rows before comparing the POC line. A matching POC alone is a weak test because many different distributions can have the same maximum row.

From level to strategy​

A condition such as "price returns to the prior profile POC" still needs a tolerance, confirmation time, entry rule, exit rule, and invalidation. Specify whether the reference is a row boundary or midpoint. Then add sizing, costs, and fill assumptions to a test.

This article reports no NVDA, TSLA, or AMD trades and no proven increase in signal accuracy. The practical goal is a reproducible profile whose data and timing can be audited before any trading interpretation is evaluated.