OPEN-SOURCE SCRIPT

VP History Widget

2 835
VP History Widget plots a user-defined number of completed Volume Profiles (VPs) directly to the right of your price chart in real price coordinates. Each profile is calculated from the actual intraday bars that made up that session — giving an accurate picture of where volume was distributed across the price range of each past session. The sessions available are daily, weekly and monthly volume profiles.

Unlike volume profiles drawn on top of historical candles, this widget repositions all profiles into future bar space to the right of the current price, keeping your chart clean and uncluttered. Because everything is drawn in real price coordinates there is no distortion — profiles appear at exactly the correct size and price level relative to your chart.


HOW IT WORKS

Volume profiles are built using lower-timeframe intraday bar data (request.security_lower_tf), so the profile reflects the actual volume distribution across the session rather than a single-bar approximation. The session's price range is divided into a user-defined number of equal bins. For each bin, volume is split into bullish and bearish components using a proportional wick/body weighting method — the same approach used in professional volume profile tools. This data is stored in a rolling buffer and drawn on the last bar as a side-by-side histogram.

The Point of Control (POC) is the bin with the highest total volume. The Value Area High (VAH) and Value Area Low (VAL) are calculated by expanding outward from the POC until cumulative volume reaches the user-defined Value Area percentage (default 70%), following standard Market Profile methodology.


WHAT IT SHOWS

- Green histogram bars: volume from bullish (up-close) bars per price bin
- Red histogram bars: volume from bearish (down-close) bars per price bin
- POC line: price level with the highest volume for that session
- VAH / VAL lines: upper and lower boundaries of the Value Area
- Session labels: identify which session each profile belongs to (e.g. Daily -1, Daily -2)


TYPICAL USE CASES

- Identifying high-volume nodes (HVNs) and low-volume nodes (LVNs) from prior sessions as potential support and resistance
- Comparing volume distribution across multiple sessions to gauge market acceptance at price levels
- Spotting sessions where price moved quickly through a range — thin profiles indicate low acceptance and potential reversion zones
- Keeping your chart clean by comparing N previous session VPs without overlapping historical candles


SETTINGS

Show Widget — master on/off toggle.

Offset from price (default 10, range 1-50) — bars of space between the last candle and the first VP. Increase if profiles overlap your candles when zoomed out.

VP Width (default 10, range 3-40) — horizontal width of each volume profile in bars. Wider makes individual bins easier to read.

Gap between VPs (default 3, range 1-10) — spacing in bars between adjacent profiles.

Number of Sessions (default 5, range 1-10) — how many completed sessions to display. The most recent is on the right (marked with a triangle), oldest on the left.

Session Timeframe (Daily / Weekly / Monthly) — the period each volume profile covers.

VP Bins (default 50, range 5-50) — number of equal price buckets the session range is divided into. More bins gives finer resolution. With 5 sessions the maximum is 50 bins (5 x 50 x 2 = 500 boxes, TradingView's limit). With 10 sessions keep bins at 20 or below.

Value Area % (default 70, range 1-100) — percentage of total session volume that defines the Value Area. 70 is the standard Market Profile convention.

Profile Data (Volume / Open Interest) — Volume uses standard bar volume. Open Interest uses the change in OI, which requires a futures symbol with an OI feed.

Smooth Volume (default off) — applies a 5-period EMA to volume before building the profile, smoothing out single-bar spikes.

Up Volume color — fill color for bullish volume bins.

Down Volume color — fill color for bearish volume bins.

POC Line color — color of the Point of Control line.

VAH / VAL color — color of the Value Area boundary lines.

Separator color — color of the thin vertical line on the left edge of each VP slot.

Show POC — toggle the POC line and label on/off.

Show VAH / VAL — toggle Value Area boundary lines and labels on/off.

Show Labels — toggle all text labels on/off for a minimal look.


BOX LIMIT REFERENCE

TradingView limits indicators to 500 boxes. Each bin draws up to 2 boxes (green + red). Use this as a guide:

5 sessions — max 50 bins (500 boxes, at the limit)
6 sessions — max 40 bins (480 boxes)
7 sessions — max 35 bins (490 boxes)
8 sessions — max 30 bins (480 boxes)
9 sessions — max 27 bins (486 boxes)
10 sessions — max 24 bins (480 boxes)

If you see profiles with missing bars, reduce VP Bins or Number of Sessions.


IMPORTANT NOTES

- Best used on intraday chart timeframes (1m to 4H). When the chart timeframe equals the session timeframe, only a single candle is available and the profile will be approximate.
- The widget requires at least N+1 completed sessions of history to populate. On first load it may take a moment to build.
- Open Interest mode will silently fall back to volume on symbols without an OI feed.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.