Fr3d0's Volume Profile Visible Range (VPVR)

Hi guys,
today I’m gonna show you my implementation of the Volume Profile Visible Range indicator, in short VPVR.
The VPVR is an advanced charting indicator available on a TradingView Pro used to display trading activity over a specified period and plots histograms on the chart which reveals dominant and significant price levels based on volume.
In essence gives an indication of Supply or demand at a certain price.
Key properties of the VPVR indicator:
- Number of bars (period)
- Number of histograms (resolution)
- Point of Control
High level overview
Volume Profile is basically volume by price. The volume profile takes each price point and tells us how many transactions occurred at these levels. The longer the histogram the more the transactions that happened.

High Volume Node
In short HVN is the point in the volume profile where there is more volume than average.
An HVN forms when theprice spends a great deal of time at a certain level and can therefore be seen as areas of consolidation.
Point of Control
In short PoC is the highest HVN in the volume profile.
Low Volume Node
In short LVN is the point in the volume profile where there is less volume than average.
These areas are historical areas where price burst through the price range and there was little market interest, they are also referred as the “Unfair Market Price” so price tends to spend very little time in these areas.
Value Area
In short VA is where 70% of the volume is located in the volume profile.
What is interesting about the value area is that it will act as resistance in a bearish market and as support in a bullish market.
Clearance Area
In short CA is which there are only LVN, if price enters this area expect it to move through pretty quickly.
Low level implementation
At the core of VPVR there’s a concept called “bucketization”.
Question: what is bucketization?
Answer: bucketization consists of identifying metrics with high predictive power and combine them appropriately.
I think this is a problem of bucketization because what the VPVR does is to take a price range, divide it into buckets and fill them up with the volume that was produced in each bucket’s range over the given period.

The more we divide our price range the finer the resolution, but also the less significant each bucket will become.
The steps are:
1. Get the price range with min and max over the give period;
2. Divide the range into buckets;
3. Loop over each candle of the given period and proportionally assign volume to one or more bucket.
Question: how to assign volume to buckets?
Answer: we need to calculate the right amount to add to each bucket for each candle. If 20% of a candle lies on a bucket then that bucket needs to have 20% of the volume of that candle, the rest 80% belongs to other buckets.
To get the percentage of a candle on a given bucket we have to find the price range of the candle contained within the bucket, then divide that amount by the entire length of the candle.
How to bucketize
Let’s examine the 5 cases that may arise:

In this first case the candle is above our bucket so our formula should return a good 0.

In the second case the candle is partially contained in the bucket, in the top part of the latter. This means a certain percentage of volume will be added to the bucket.

In this third case the candle fills the bucket range entirely, this is also a case in which a percentage of the volume will be added to the bucket.

The fourth case is that in which a part of the candle is contained in the bucket from the bottom of its range. Yet another case in which part of the volume is contained in the bucket.

This fifth and last case is redundant, as the first the candle is out of range and our calculation should return a 0.
Question: what are the formulas of A, B, C and Target respectively?
Answer:
- A = Max(candle_high, bucket_top) - Min(candle_low, bucket_bottom);
- B = Max(candle_high, bucket_top) - Min(candle_high, bucket_top);
- C = Max(candle_low, bucket_bottom) - Min(candle_low, bucket_bottom);
- Target = A - B - C.
Now that we now how to calculate the price range belonging to each bucket we need to calculate a percentage of volume to fill the bucket with.
The formula is trivially simple:
Volume * Target / (candle_high - candle_low).

Question: can we distinguish between buy volume and sell volume? If so, how?
Answer: yes we can and the following paragraph will teach you how.
Put it simply we can use the difference between the extremes of a candle (low and high) and its close price to get the buy and sell volumes.
The formulas for that are:
- Buy volume = Volume * (close - low) / (high - low);
- Sell volume = Volume * (high - close) / (high - low).


I know this is rather simplicistic but it makes sense.
Closing thoughts
This post is a working progress and I’m going to give more details if necessary.
A working draft implementing what’s above can be found at: https://gist.github.com/4skinSkywalker/d5e42f46851decf69054e0d0287ab6f5.
If you are going to take piece from my gist don’t forget to give me credit!
I hope you liked this article as much as I liked writing it! ❤
P.S.: Now my indicator is publicly available and can be found at: https://www.tradingview.com/script/oBu2dpeL-Fr3d0-s-Volume-Profile-Visible-Range/.
Thanks,
Fredo Corleone