Volume profile (VPVR) by RagingRocketBull

Script URL

This indicator calculates Volume Profile for a given range and shows it as a histogram consisting of 100 horizontal bars.
This is basically the MAX SLI version with +50 more Pinescript v4 line objects added as levels.
It can also show Point of Control ( POC ), Developing POC , Value Area/VWAP StdDev High/Low as dynamically moving levels.
Free accounts can't access Standard TradingView Volume Profile , hence this indicator.

There are several versions: Free Pro, Free MAX SLI, Free Ultra SLI, Free History. This is the Free Ultra SLI version. The Differences are listed below:

  • Free Pro: 25 levels, +Developing POC , Value Area/VWAP High/Low Levels, Above/Below Area Dimming
  • Free MAX SLI: 50 levels, 2x SLI modes for Buy/Sell or even higher res 150 levels
  • Free Ultra SLI: 100 levels, packed to the limit, 2x SLI modes for Buy/Sell or even higher res 300 levels
  • Free History: auto highest/lowest, historic poc/va levels for each session

Features:

  • High-Res Volume Profile with up to 100 levels (line implementation)
  • 2x SLI modes for even higher res: 300 levels with 3x vertical SLI, 100 buy/sell levels with 2x horiz SLI
  • Calculate Volume Profile on full history
  • POC , Developing POC Levels
  • Buy/Sell/Total volume modes
  • Side Cover
  • Value Area, VAH/VAL dynamic levels
  • VWAP High/Low dynamic levels with Source, Length, StdDev as params
  • Show/Hide all levels
  • Dim Non Value Area Zones
  • Custom Range with Highlighting
  • 3 Anchor points for Volume Profile
  • Flip Levels Horizontally
  • Adjustable width, offset and spacing of levels
  • Custom Color for POC/VA/VWAP levels, Transparency for buy/sell levels

WARNING:

  • Compilation Time: 1 min 20 sec

Usage:

  • specify max_level/min_level/spacing (required)
  • select range (start_bar, range length), confirm with range highlighting
  • select volume type: Buy/Sell/Total
  • select mode Value Area/VWAP to show corresponding levels
  • flip/select anchor point to position the buy/sell levels
  • use Horiz Buy/Sell SLI mode with 100 or Vertical SLI with 300 levels if needed
  • use POC/Developing POC/VA/VWAP High/Low as S/R levels. Usually daily values from 1-3 days back are used as levels for the current day.

SLI:
use SLI modes to extend the functionality of the indicator:

  • Horiz Buy/Sell 2x SLI lets you view 100 Buy/Sell Levels at the same time
  • Vertical Max_Vol 3x SLI lets you increase the resolution to 300 levels
  • you need at least 2 instances of the indicator attached to the same chart for SLI to work

1) Enable Horiz SLI:

  • attach 2 indicator instances to the chart
  • make sure all instances have the same min_level/max_level/range/spacing settings
  • select volume type for each instance: you can have a buy/sell or buy/total or sell/total SLI. Make sure your buy volume instance is the last attached to be displayed on top of sell/total instances without overlapping.
  • set buy_sell_sli_mode to true for indicator instances with volume_type = buy/sell, for type total this is optional.
  • this basically tells the script to calculate % lengths based on total volume instead of individual buy/sell volumes and use ext offset for sell levels
  • Sell Offset is calculated relative to Buy Offset to stack/extend sell after buy. Buy Offset = Zero - Buy Length. Sell Offset = Buy Offset - Sell Length = Zero - Buy Length - Sell Length
  • there are no master/slave instances in this mode, all indicators are equal, poc/va levels are not affected and can work independently, i.e. one instance can show va levels, another - vwap .

2) Enable Vertical SLI:

  • attach the first instance and evaluate the full range to roughly determine where is the highest max_vol/poc level i.e. 0..20000, poc is in the bottom half (third, middle etc) or
  • add more instances and split the full vertical range between them, i.e. set min_level/max_level of each corresponding instance to 0..10000, 10000..20000 etc
  • make sure all instances have the same range/spacing settings
  • an instance with a subrange containing the poc level of the full range is now your master instance (bottom half). All other instances are slaves, their levels will be calculated based on the max_vol/poc of the master instance instead of local values
  • set show_max_vol_sli to true for the master instance. for slave instances this is optional and can be used to check if master/slave max_vol values match and slave can read the master's value. This simply plots the max_vol value
  • you can also attach all instances and set show_max_vol_sli to true in all of them - the instance with the largest max_vol should become the master

Auto/Manual Ext Max_Vol Modes:

  • for auto vertical max_vol SLI mode set max_vol_sli_src in all slave instances to the max_vol of the master indicator: VolumeProfileFree_MAX_RRB: Max Volume for Vertical SLI Mode. It can be tricky with 2+ instances
  • in case auto SLI mode doesn't work - assign max_vol_sli_ext in all slave instances the max_vol value of the master indicator manually and repeat on each change
  • manual override max_vol_sli_ext has higher priority than auto max_vol_sli_src when both values are assigned, when they are 0 and close respectively - SLI is disabled
  • master/slave max_vol values must match on each bar at all times to maintain proper level scale, otherwise slave's levels will look larger than they should relative to the master's levels.
  • Max_vol (red) is the last param in the long list of indicator outputs
  • the only true max_vol/poc in this SLI mode is the master's max_vol/poc. All poc/va levels in slaves will be irrelevant and are disabled automatically. Slaves can only show VWAP levels.
  • VA Levels of the master instance in this SLI mode are calculated based on the subrange, not the whole range and may be inaccurate. Cross check with the full range.

WARNING!

  • auto mode max_vol_sli_src is experimental and may not work as expected
  • you can only assign auto mode max_vol_sli_src = max_vol once due to some bug with unhandled exception/buffer overflow in Tradingview. Seems that you can clear the value only by removing the indicator instance
  • sometimes you may see a study in error state error when attempting to set it back to close. Remove indicator/Reload chart and start from scratch
  • volume profile may not finish to redraw and freeze in an ugly shape after an UI parameter change when max_vol_sli_src is assigned a max_vol value. Assign it to close - VP should redraw properly, but it may not clear the assigned max_vol value
  • you can't seem to be able to assign a proper auto max_vol value to the 3rd slave instance
  • 2x Vertical SLI works and tested in both auto/manual, 3x SLI - only manual seems to work (you can have a mixed mode: 2nd instance - auto, 3rd - manual)