RagingRocketBull

Volume Profile Free MAX SLI (50 Levels Value Area VWAP) by RRB

Volume Profile Free MAX SLI by RagingRocketBull 2019
Version 1.0

All available Volume Profile Free MAX SLI versions are listed below (They are very similar and I don't want to publish them as separate indicators):
ver 1.0: style columns implementation
ver 2.0: style histogram implementation
ver 3.0: style line implementation

This indicator calculates Volume Profile for a given range and shows it as a histogram consisting of 50 horizontal bars.
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 History. This is the Free MAX 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, packed to the limit, 2x SLI modes for Buy/Sell or even higher res 150 levels
- Free History: auto highest/lowest, historic poc/va levels for each session

Features:
- High-Res Volume Profile with up to 50 levels (3 implementations)
- 20-30x faster than the old Pro versions especially on lower tfs with long history
- 2x SLI modes for even higher res: 150 levels with 3x vertical SLI, 50 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 and Transparency for buy/sell levels

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 SLI mode for 50 Buy/Sell or Vertical SLI for 150 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 50 Buy/Sell Levels at the same time
- Vertical Max_Vol 3x SLI lets you increase the resolution to 150 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. 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


Notes:
- This code is 20x-30x faster (main for cycle is removed) especially on lower tfs with long history - only 2-3 sec load/redraw time vs 30-60 sec of the old Pro versions
- Instead of repeatedly calculating the total sum of volumes for the whole range on each bar, vol sums are now increased on each bar and passed to the next in the range making it a per range vs per bar calculation that reduces time dramatically
- hist_base for levels still results is ugly redraw
- if you don't see a volume profile check range settings: min_level/max_level and spacing, set spacing to 0 (or adjust accordingly based on the symbol's precision, i.e. 0.00001)
- you can view either of Buy/Sell/Total volumes, but you can't display Buy/Sell levels at the same time using a single instance (this would 2x reduce the number of levels). Use 2 indicator instances in horiz buy/sell sli mode for that.
- Volume Profile/Value Area are calculated for a given range and updated on each bar. Each level has a fixed length. Offsets control visible level parts. Side Cover hides the invisible parts.
- Custom Color for POC/VA/VWAP levels - UI Style color/transparency can only change shape's color and doesn't affect textcolor, hence this additional option
- Custom Width - UI Style supports only width <= 4, hence this additional option
- POC is visible in both modes. In VWAP mode Developing POC becomes VWAP , VA High and Low => VWAP High and Low correspondingly to minimize the number of plot outputs
- You can't change buy/sell level colors from input (only plot transparency) - this requires 2x plot outputs => 2x reduces the number of levels to fit the max 64 limit. That's why 2 additional plots are used to dim the non Value Area zones
- All buy/sell volume lengths are calculated as % of a fixed base width = 100 bars (100%). You can't set show_last from input to change it
- There's no such thing as buy/sell volume , there's just volume , but for the purposes of the Volume Profile method, assume: bull candle = buy volume , bear candle = sell volume


P.S. Gravitonium Levels Are Increasing. Unobtainium is nowhere to be found!

Links on Volume Profile and Value Area calculation and usage:
https://www.tradingview.com/wiki/Volume_...
https://stockcharts.com/school/doku.php?...
https://onlinelibrary.wiley.com/doi/pdf/...
Phát hành các Ghi chú: All available Volume Profile Free MAX SLI versions are listed below:
ver 1.0: plot style columns implementation
ver 2.0: plot style histogram implementation
ver 3.0: plot style area implementation
ver 4.0: plot style line implementation
ver 5.0: all-in-one plot styles 1-4 implementation
ver 6.0: pinescript v4 line objects implementation

Differences between implementations:

1. style: ver 1-4: columns, histogram, area, and line respectively;
ver 5: any style;
ver 6: ps v4 line objects instead of plots;

2. internal buy/sell mode: ver 1-5: no
ver 6: yes

3. sli modes: ver 1-6: yes

4. min/max level: ver 1-3,5: manual control, auto not possible
ver 4,6: manual control, auto highest/lowest in range technically possible, but discarded

5. 100% base width/length: ver 1-5: fixed (plots);
ver 6: dynamic level length control (line objects)

6. hist_base: ver 1-3: hist_base (ugly redraw),
ver 5: depends on style used
ver 4,6: no hist_base (clean redraw)

7. level width/height: ver 1: fixed bar width, no density control (discrete equalizer), spacing instead of height control
ver 2: level density control (discrete, appears more solid due to overlapping), spacing instead of height control
ver 3: density control not needed (continuous seamless area), spacing instead of height control
ver 5: depends on style used
ver 4,6: density control not needed (continuous seamless line), line width/level height control (thickness) + log scale adjustment

8. level gaps/spacing: ver 1-3: no gaps, spacing control to eliminate gaps;
ver 5: depends on style used
ver 4,6: gaps, vertical shift, line width/level height control (thickness) + log scale adjustment to eliminate gaps, no spacing control

9. transparency: ver 1,3,4,6: good;
ver 2: mediocre transparency (density is in the way)
ver 5: depends on style used

10. cover: ver 1-5: plot side cover, nva zone cover;
ver 6: covers not needed, transparency is applied directly to line objects

Changes in ver 2.0:
- histogram implementation
- floor replaced with round for more accurate len calculation
- cover style set to area (continuous cover), cover width, cover_ext_height removed as not needed
- added level width/density
- added cover ext_length to compensate for large length/density
- added cover offset relative to zero
- fixed flipped levels offset relative to zero
- fixed end of range offset for all history
- fixed nva zone cover transparency
Phát hành các Ghi chú: ver 3.0: plot style area implementation

the cleanest of plot histbase variety
Phát hành các Ghi chú: ver 4.0: plot style line implementation

- more straightforward and clean, doesn't have histbase redraw issues for levels,
- side cover still uses plot histbase style area
- large width values produce unwanted horiz expansion beyond start/end points of a level, unlike style area => solve with zero/cover offsets. Can't be fixed in adjust width for log scale mode.
- adjust width for log scale mode may break at log(0) and log(1) extremes when level, h are < 1 => produces infinite widths, only level1 = 0 can be fixed
Phát hành các Ghi chú: ver 5.0: all-in-one plot styles 1-4 implementation

apparently, you can assign style from input using an int var instead of a string (doesn't work).
Phát hành các Ghi chú: Pros: the cleanest version of them all.
Cons: longer compile time.

Changes in ver 6.0:
- Pinescript v4 support
- line objects implementation instead of plots, clean redraw
- internal buy/sell mode using 2x25 levels. You don't have to use SLI now
- custom color/transparency for line objects
- side cover, nva zones removed - transparency is applied directly to line objects
- 100% base level length can be set from input - you can control max width of Volume Profile
- level, offset, len and width replaced with functions
- alt range highlighting option using barcolor
- shift now also affects va levels, but not VWAP levels
- show level stats option: index, price, length, buy/sell/total volumes

WARNING:
- Compilation Time: 1 min vs 35-40 sec for prev versions
- Slower redraw times 5-10 sec with level stats on especially on lower tfs with long history

Notes:
- uses Pinescript v3 compatibility framework

- Line Objects
- line objects don't use plot/histbase -> clean redraw with no limitations
- line objects are always shown on top of other objects, such as plot levels, zero line and side cover, it's not possible to cover/move them below.
- line objects can have variable length, use actual x,y coords and don't need side cover, while all plot levels have a fixed length of 100 bars, use offset and require cover.
- all key properties of line objects, such as x,y coords, color can be modified, objects can be moved/deleted/modified, while this is not possible for static plot levels.
- large width values cause line objects to expand only up/down from center while their length remains the same and stays within the level's start/end points similar to an area style.
- you can change level color/transparency of line objects. Due to Pinescript limitations, only discrete values are supported.

- Internal Buy/Sell mode lets you view 2x25 Buy/Sell Levels at the same time:
- when num_levels > 25 => num_levels/2 are used, otherwise num_levels are used as buy/sell levels
- volume type total: line = sell, plot = total => line objects appear as red sell levels on top of blue total levels (overlapping)
- volume type buy: line = buy, plot = total => line objects appear as green buy levels on top of blue total levels (overlapping)
- volume type sell: line = sell, plot = buy => line objects appear as red sell levels extending blue buy levels from the edge (no overlapping)

- Volume Profile calculation is not affected by shift, it is for visual correction only. Set shift to 0 to see the actual levels used in level stats
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
A Note on Displaying Indicator Values:

Tradingview has just changed the way arguments and values are displayed for all indicators - long lists of arguments/values are now concatenated with "..." by default.
This is fine for simple indicators, but doesn't work for complex ones with lots of parameters like mine => all values are trimmed at the end/not displayed.
This doesn't affect screenshots.

To fully expand a long list of arguments: hower your mouse over the indicator's name - you will see a tooltip with all the arguments.

To fully expand a long list of output values: right click on the indicator's name and check Wrap Text - you will see the complete list of values wrapped on several lines

This is crucial but not intuitive that's why I decided to mention it.

Alternatively you can right click on the price scale axis, select Labels, and check Indicator Name Label and Indicator Last Value Label and leave No Overlapping Labels checked but all that adds clutter to your chart making it less readable.
Phản hồi
I have been looking into the concept and think it's great addition but can it be used with Forex pairs?
Phản hồi
@Klarkkent1, it should work on any chart, for example here is a USDJPY D chart
you will need to adjust max level/min level, spacing (1) and zero line offset adjustment (-20) accordingly

Phản hồi
Very good work Please give me the indicator My best wishes to you
Phản hồi
by default it doesn't load anything. by default it needs to load something.
Phản hồi
RagingRocketBull boreddude001
@boreddude001,
Hey, I understand your frustration but true auto range is not possible in this version due to Pinescript's limitations:

- plot zero histbase depends on pl and can't be mutable/function, must be const/expression => will work if plot zero is replaced with bgcolor or a 2-bar wide line object or removed completely - possible

- highest/lowest => na for the first range-1 bars and can't be used => Volume Profile will be empty/incorrect if n < 2*range => max_high should be calculated manually/accumulated on each bar - possible, but the effect on volume profile calculation is to be studied

- auto highest/lowest levels must be calculated once and remain fixed (freeze) for the entire session because volume is accumulated on each bar and any changes in vertical range will result in incorrect calculation of Volume Profile due to variable range min/max bounds - whether this is possible remains to be seen in future versions.

- most importantly, variable auto min/max bounds will work in Pro version with Line Objects when Volume Profile for the entire range is calculated on each bar (very slow), not accumulated. You can check it out when it's released.

- I could show a label with a text message on startup instructing the user to enter min/max levels but advanced users will consider it annoying. Also if you plan to actually use it, you're supposed to read the description anyway, learn advanced concepts like SLI etc.

Again, the focus of this version is speed of calculation and more levels coupled with the cleanest new v4 look. Both MAX/Ultra are advanced tools designed to squeeze the max out of Pinescript. Compilation time has been sacrificed.

Often the simplest and most robust things are the hardest to do, as only going through lots of iterations of the more complex ones will make you understand what simplicity is.
Phản hồi
way too complicated... unusable by an average person really...

amazing job though.. hopefully, it can be used by someone more sophisticated... or maybe you can make a way simpler version... :)
Phản hồi
@omegru,
hey, you can try the Free Pro version with 25 levels (will be updated soon) or the standard TradingView VPVR that needs a paid account
+1 Phản hồi
Solution 1:
- if your indicator has line objects - keep them visible. When line objects are visible everything in replay mode redraws correctly, including plot level offsets
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Giá Quy tắc Áp dụng Người điều hành Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Trung tâm Trợ giúp Yêu cầu tính năng Blog & Tin tức Câu hỏi thường gặp Wiki Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Đồng TradingView Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất