Indicator · Pine Script v6 · On the chart

DIY Volume Profile

by jayadevrana

DIY Volume Profile is an indicator that calculates the point of control and value area using volume distribution across price rows based on the last specified lookback bars.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code79
Settings4inputs
LicenceMPL-2.0
Last update4 days ago26 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

79 lines of Pine Script v6 from scripts/volume-profile.pine.txt, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

volume-profile.pine.txt
//@version=6
indicator("DIY Volume Profile", overlay = true, max_bars_back = 500)

lookback = input.int(150, "Bars in the profile", minval = 20, maxval = 400)
rows = input.int(24, "Price rows", minval = 6, maxval = 40)
vaPct = input.float(70, "Value area %", minval = 10, maxval = 95)
maxW = input.int(24, "Widest row, in blocks", minval = 4, maxval = 40)

var array<float> bins = array.new_float(rows, 0)
float poc = na
float vah = na
float val = na
int pocRow = na
int vaLo = na
int vaHi = na

hiP = ta.highest(high, lookback)
loP = ta.lowest(low, lookback)
step = (hiP - loP) / rows
inWindow = bar_index >= last_bar_index - lookback + 1
ready = inWindow and step > 0

if ready
    array.fill(bins, 0)
    for i = 0 to lookback - 1
        h = high[i]
        l = low[i]
        v = nz(volume[i])
        a = math.min(rows - 1, math.max(0, math.floor((l - loP) / step)))
        b = math.min(rows - 1, math.max(0, math.floor((h - loP) / step)))
        for r = a to b
            rLo = loP + r * step
            part = math.min(h, rLo + step) - math.max(l, rLo)
            share = h > l ? math.max(0, part) / (h - l) : 1.0
            array.set(bins, r, array.get(bins, r) + v * share)

if ready
    pocRow := array.indexof(bins, array.max(bins))
    poc := loP + (pocRow + 0.5) * step

if ready
    target = array.sum(bins) * vaPct / 100
    acc = array.get(bins, pocRow)
    vaLo := pocRow
    vaHi := pocRow
    while acc < target and (vaLo > 0 or vaHi < rows - 1)
        up = vaHi < rows - 1 ? array.get(bins, vaHi + 1) : -1.0
        dn = vaLo > 0 ? array.get(bins, vaLo - 1) : -1.0
        if up >= dn
            vaHi += 1
            acc += up
        else
            vaLo -= 1
            acc += dn
    vah := loP + (vaHi + 1) * step
    val := loP + vaLo * step

pH = plot(vah, "Value area high", color.new(color.teal, 0), 1,
  plot.style_linebr)
pL = plot(val, "Value area low", color.new(color.teal, 0), 1,
  plot.style_linebr)
fill(pH, pL, color.new(color.teal, 90), "Value area")
plot(poc, "POC", color.new(color.orange, 0), 3, plot.style_linebr)

var table prof = table.new(position.top_right, 2, 40,
  frame_width = 1, frame_color = color.gray)
if barstate.islast and ready
    top = array.max(bins)
    for r = 0 to rows - 1
        w = top > 0 ? math.round(array.get(bins, r) / top * maxW) : 0
        blocks = str.repeat("█", w)
        inVA = r >= vaLo and r <= vaHi
        c = r == pocRow ? color.orange : inVA ? color.teal : color.gray
        px = str.tostring(loP + (r + 0.5) * step, format.mintick)
        row = rows - 1 - r
        table.cell(prof, 0, row, px, text_color = c,
          text_size = size.tiny)
        table.cell(prof, 1, row, blocks, text_color = c,
          text_size = size.tiny, text_halign = text.align_left)

Overview

DIY Volume Profile plots horizontal lines for the value area high and low along with the POC on the price chart. A table is drawn in the top right showing price levels and block representations of volume per row. Settings control the bars in profile, price rows, value area percentage, and widest row width. It updates the profile as new bars complete and draws directly on the price chart.

Details

Published by

jayadevrana on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingema-crossoverpine-scriptpine-script-v6pinescriptrsitechnical-analysistrading-automationtrading-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Bars in the profileint150lookback
Price rowsint24rows
Value area %float70vaPct
Widest row, in blocksint24maxW
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This overlay indicator builds a horizontal momentum profile over a chosen lookback. It splits price into rows and plots the average WaveTrend of each zone as a bar colored by direction, plus an optional MFI reference band that stays gray when real trade volume

Indicator v6 Oscillators & momentumVolume
Updated 3 days ago · MIT GitHub repository of Momentum Profile [WavesUnchained]
5 stars

This indicator builds a frozen volume profile over a fixed, half-open timestamp range and draws it on the price chart. It aggregates one-minute source bars into output rows sized by a chosen tick count, marks a configurable value-area percentage, and can plot

Indicator v6 VolumeSupport & resistance
Updated 4 days ago · MPL-2.0 GitHub repository of VP RSD Fixed Range Shelf Diagnostic
4 stars

This overlay indicator draws an on-chart depth-of-market table that splits volume at each price tick into estimated buy volume, sell volume, delta, and session volume. Growing text bars compare buyers and sellers, and recent bars approximate resting bid and as

Indicator v5 VolumeScreeners & dashboards
Updated 6 months ago · None stated GitHub repository of Custom DOM - Bookmap Style
4 stars

This indicator overlays an order flow intelligence suite directly on the price chart. It renders a liquidity heatmap across configured price zones, alongside an on-chart information panel displaying volume delta, cumulative volume delta, a momentum compass bas

Indicator v6 VolumeScreeners & dashboards
Updated 2 weeks ago · MIT GitHub repository of GHOST — OrderFlow Intelligence

More Volume scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers