OPEN-SOURCE SCRIPT

Precision Volume Profile [AxeAlgo]

2 425
OVERVIEW

Precision Volume Profile [AxeAlgo] is a native Pine Script volume
profile tool: it rebuilds a full price-by-volume histogram for whatever
range you anchor it to — the visible chart, a fixed bar count, the
current day, week, month, or a custom trading session — and derives the
Point of Control (POC), Value Area High/Low (VAH/VAL), a Prior Period
Value Area with open-type and POC-migration classification, and a
session VWAP with standard-deviation bands, all from the same underlying
bar history.

This is the classic Market Profile / Volume Profile toolkit used to
judge where the market has actually traded the most volume — not just
where price is right now — and how today's activity compares to the
period before it. Everything here runs natively on your own chart data;
there are no external requests, no repainting of confirmed history, and
no hidden calculations.

This script is free and open-source, published so the full methodology
described below is verifiable directly in the source code.

============================================================
HOW IT WORKS
============================================================

Volume Profile Histogram
----------------------------
For the selected range, price is divided into rows (automatically sized
to the range, or set manually) and every historical bar's volume is
distributed across the rows its high-low span touches. Each bar's
volume is split into an estimated buy side and sell side based on where
that bar's close sits between its low and high — a bar that closed near
its high is treated as more buy-weighted, one that closed near its low
as more sell-weighted. The row with the most total volume becomes the
POC; rows are colored on a gradient between two configurable colors
based on that estimated buy/sell split, with opacity scaled to each
row's relative strength versus the POC.

Value Area
----------------------------
The Value Area is expanded outward from the POC two rows at a time —
comparing the volume of the next pair of rows above versus the next
pair below and adding whichever pair holds more volume — until the
accumulated volume reaches the configured Value Area percentage (70% by
default, the standard Market Profile convention). This is the same
textbook two-row-pair expansion method used for both the live profile
and the Prior Period snapshot below, so the two stay directly
comparable.

Anchor Modes
----------------------------
Six ways to define what range the profile is built from: Visible Range
(whatever's currently on screen), Fixed Bars (a set lookback), Day,
Week, Month, or a fully custom Session (configurable start/end time and
timezone, e.g. 0930-1600 for US regular trading hours). A dotted
vertical line marks exactly where the current profile's lookback
begins whenever that boundary isn't simply the edge of your screen.

Prior Period Value Area, Open Type & POC Migration
----------------------------------------------------
At each period boundary (Day or Week, configurable), the script
snapshots the period that just closed: its Value Area is drawn as a
dashed box extending forward, today's open is classified as Above,
Below, or Inside that prior value, and the new POC is compared against
the previous one to report whether it's migrating up, down, or holding
flat. This is the standard "open-type" read used to gauge whether a
session is likely to be rotational or trending.

Session VWAP & Standard Deviation Bands
------------------------------------------
A running volume-weighted average price with up to two configurable
standard-deviation bands on each side, calculated with the same
volume-weighted variance formula as TradingView's own VWAP tool. It can
reset either at calendar midnight or at your custom session's open
time — the same session window used by the Session anchor mode above,
so the two can be kept in sync.

Stats Panel
----------------------------
An optional on-chart table summarizing the active anchor mode, bar/row
count, POC, VAH/VAL, Value Area width, estimated buy/sell split and
delta, total volume, open type, POC migration, and current VWAP —
everything the script computes, in one place, without needing to
hover over individual lines.

Alerts
----------------------------
Two alert conditions: price crossing the POC, and price entering or
exiting the Value Area.

============================================================
ACCURACY NOTE — HOW BUY/SELL VOLUME IS ESTIMATED
============================================================

Pine Script does not have access to real trade-by-trade tape or
bid/ask data on standard bars, so no volume profile indicator can
measure "true" buy versus sell volume directly. This script — like
essentially every volume profile tool on TradingView — estimates it
from each bar's own OHLC: where the close sits between the low and the
high. This is a widely used, reasonable proxy, but it is an estimate,
not measured order flow. Treat the buy/sell split and Delta reading as
directional context, not a precise execution metric.

============================================================
HOW TO USE IT
============================================================

Add the indicator, pick an Anchor mode that matches how you trade
(Visible Range for manual exploration, Day/Week/Session for a
consistent recurring reference), and set the Value Area percentage if
you want something other than the 70% default. Every input has an
in-editor tooltip explaining exactly what it changes. The Prior Period
panel rows (Open Type, POC Migration) are most useful checked once at
the start of a session; the POC/VAH/VAL lines and histogram are
intended as a persistent reference for the rest of the period.

============================================================
REPAINTING & REAL-TIME BEHAVIOR
============================================================

The profile, its lines, and the stats panel are only (re)computed on
the most recent bar (barstate.islast) — not on every historical bar —
for performance, and are cleared and redrawn from scratch each time
they update. In Visible Range or Fixed Bars mode this means the profile
legitimately changes as you scroll, zoom, or as new bars form — that's
the tool responding to a different input range, not repainting of a
fixed historical value. In Day/Week/Month/Session mode, once a period
has closed its POC, VAH, and VAL are fixed and do not change on
subsequent reloads; only the currently forming period's profile updates
live as new bars print. The Prior Period Value Area snapshot is
computed once, at the moment its period closes, and is never
recalculated afterward.

============================================================
LIMITATIONS — PLEASE READ
============================================================

- Buy/sell volume is an OHLC-based estimate, not real tape data (see
the Accuracy Note above).
- The Value Area expansion is a discrete two-row-pair algorithm; on
very coarse row counts it can land a percentage point or two away
from the exact target rather than hitting it precisely.
- "Max Bars Stored" caps how much history is kept in memory for
performance; extremely long Fixed Bars or Visible Range lookbacks on
very low timeframes can exceed it and get truncated.
- The custom Session anchor and VWAP session-open reset depend on the
Session Time and Timezone inputs actually matching your instrument's
real trading session — mismatched inputs will produce a
technically-correct but practically meaningless boundary.
- This is a discretionary analysis tool intended to support your own
read of the market, not a mechanical, guaranteed-signal system.

============================================================
RISK DISCLAIMER
============================================================

This script is provided for educational and informational purposes
only. It is not financial advice, and it is not a recommendation to buy
or sell any security or instrument. Trading and investing involve
substantial risk of loss and are not suitable for every investor. Past
performance is not indicative of future results. Always do your own
research and consider consulting a licensed financial advisor before
making trading decisions. Use this indicator, and any alerts it
generates, entirely at your own risk.

============================================================
ORIGINALITY
============================================================

This is original work: the row-building and Value Area expansion
algorithms, the Prior Period snapshot and open-type/migration logic,
the session-anchor handling, and the visual design are all written
from scratch for this script. It is published free and open-source so
the full methodology described above is verifiable directly in the
source code.


כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.