Pine Script v5 · Indicator
Volume Profile Lite
A Pine Script v5 indicator built on Highest (high, 150) and Lowest (low, 150). It draws 2 lines on the price chart. 3 settings; defaults include Bars in the profile 150, Price rows 24 and Width (% of the lookback) 30.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does Volume Profile Lite repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 300 of 300 bars.
- How many settings does Volume Profile Lite have?
- 3
- Defaults include Bars in the profile 150, Price rows 24, Width (% of the lookback) 30.
- Does Volume Profile Lite run in Pine Script v6?
- Yes
- Every plotted value identical on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. The v6 script can be downloaded below.
- Does Volume Profile Lite draw on the price chart?
- Yes
- It is declared with overlay = true.
- Does Volume Profile Lite run in Zeal Terminal?
- Yes
- It compiles in 26 ms and runs 1,000 bars in 23 ms, in the browser.
BTCUSDT · 1D · default settings
- Profile high
- Profile low
- Profile high
- 87,395.70
- on the last bar
- Profile low
- 57,800.20
- on the last bar
The value of each line the script plots, on the last of 1,000 bars, with the default settings.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
-
Note
No alerts
The script declares no alertcondition, so you can't be notified when its state changes.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Bars in the profile | 150 | int · min 10 · max 1000 | top bottom span line 22 line 38 |
| Price rows | 24 | int · min 4 · max 100 | step vols line 25 line 34 |
| Width (% of the lookback) | 30 | int · min 5 · max 100 | span |
What it calculates
- Highesthigh, Bars in the profile (150)
top · line 12 - Lowestlow, Bars in the profile (150)
bottom · line 13
Signal flow
How price data and settings reach what is drawn. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
What it draws
| Output | Call | Value | By default | Line |
|---|---|---|---|---|
| Profile high | plot | top | Shown | 40 |
| Profile low | plot | bottom | Shown | 41 |
Does it repaint?
No
No repainting patterns in the source, and the live replay matched history.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip or realtime-only state. Values move while a bar forms and settle when it closes, as every indicator's do.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Other markets
The same script with default settings on 8 Binance markets, each the most recent 1,000 bars.
| Market | Profile high | Profile low |
|---|---|---|
| BTCUSDT 1D | 87,395.70 | 57,800.20 |
| BTCUSDT 4h | 87,220.00 | 79,800.00 |
| ETHUSDT 1D | 2,807.34 | 1,505.68 |
| ETHUSDT 4h | 2,777.33 | 2,318.00 |
| SOLUSDT 1D | 124.95 | 60.13 |
| SOLUSDT 4h | 124.95 | 100.43 |
| BNBUSDT 1D | 809.99 | 537.25 |
| BNBUSDT 4h | 809.99 | 705.86 |
Each line's value on the last bar.
Similar scripts
Indicators and strategies built from the same calculations.
| Script | Shares | Type |
|---|---|---|
| Donchian Channels by Zeal Terminal | highest lowest | v5 indicator |
| Fisher Transform by Zeal Terminal | highest lowest | v5 indicator |
| Alex Days HiLo Rajib by 14rajib | highest lowest | v4 strategy |
| Donchian Strat EXMO by pskoroplas | highest lowest | v4 strategy |
| Average Highest High and Lowest Low Swinger Strategy by exlux99 | lowest highest | v4 strategy |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Yes
Every plotted value identical on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.
⋯// © Zeal Terminal-//@version=5+//@version=6indicator("Volume Profile Lite", shorttitle = "VP Lite", overlay = true, max_boxes_count = 100)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 26 ms | Yes 1,000 bars in 23 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Written by Zeal Terminal and published under the Mozilla Public License 2.0.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Zeal Terminal//@version=5indicator("Volume Profile Lite", shorttitle = "VP Lite", overlay = true, max_boxes_count = 100) lookback = input.int(150, "Bars in the profile", minval = 10, maxval = 1000)rows = input.int(24, "Price rows", minval = 4, maxval = 100)widthPct = input.int(30, "Width (% of the lookback)", minval = 5, maxval = 100) // On the last bar, share each bar's volume among the price rows its range// touches, then draw one box per row. The fullest row is the point of control.top = ta.highest(high, lookback)bottom = ta.lowest(low, lookback) var array<box> drawn = array.new<box>()if barstate.islast for b in drawn box.delete(b) array.clear(drawn) step = (top - bottom) / rows vols = array.new_float(rows, 0.0) for i = 0 to lookback - 1 lo = low[i] hi = high[i] for r = 0 to rows - 1 rowLo = bottom + r * step rowHi = rowLo + step overlap = math.min(hi, rowHi) - math.max(lo, rowLo) if overlap > 0 and hi > lo array.set(vols, r, array.get(vols, r) + volume[i] * overlap / (hi - lo)) maxVol = array.max(vols) poc = array.indexof(vols, maxVol) span = math.max(1, math.round(lookback * widthPct / 100)) for r = 0 to rows - 1 w = math.round(span * array.get(vols, r) / maxVol) if w > 0 col = r == poc ? color.new(#ffb74d, 30) : color.new(#42a5f5, 70) array.push(drawn, box.new(bar_index - lookback + 1, bottom + (r + 1) * step, bar_index - lookback + 1 + w, bottom + r * step, border_color = col, bgcolor = col)) plot(top, "Profile high", color = color.new(#787b86, 60), style = plot.style_stepline)plot(bottom, "Profile low", color = color.new(#787b86, 60), style = plot.style_stepline)