Delta Volume Columns Pro [LucF]

Delta Volume Columns Pro displays delta volume information calculated with intrabar inspection. My Delta-Volume-Candles showed delta volume on the chart; this indicator provides a pane version which allows for more detailed information to be displayed. It can show stacked buy/sell/neutral volume columns, or a volume balance line which can be calculated and displayed in many different ways.

WARNING: This is an analysis tool that works on historical bars only. It does not show any realtime information, and thus cannot be used to issue alerts or for automated trading. When realtime bars elapse, the indicator will require a browser refresh, a change to its Inputs or to the chart's timeframe/symbol to calculate delta volume on those elapsed bars. Once a trader understands this, the indicator can be used advantageously to make discretionary trading decisions, as the detailed volume information it provides on past bars is much more useful than normal, consolidated volume .

The indicator has lots of options, allowing it to be used in many different ways. If you value delta volume information, I hope you will find the time required to master the use of Delta Volume Columns Pro well worth the investment. I am confident that if you combine a proper understanding of the indicator's information with an intimate knowledge of the volume idiosyncrasies on the markets you trade, you can extract useful market intelligence using this tool.


The indicator has two modes: Columns and Line.

• In Columns mode you can display stacked buy/sell/neutral columns.
• The buy section always appears above the centerline, the sell section below. The neutral volume section overlaps the centerline, split halfway above and below it.
 The buy and sell sections start where the Neutral section ends, when there is one.
• The top and bottom sections can be colored independently using 7 different methods.
• The signal line plotted in Line mode can also be displayed in Columns mode.

• Displays a single volume balance line using a zero centerline.
• A variable number of independent methods can be used to calculate the line (6), determine its color (5), and color the fill (4).
 You can thus evaluate the state of 3 different components with this single line.
• A "Divergence Levels" feature will use the line to automatically draw expanding levels on divergence events.

Features available in both modes
• The color of all components can be selected from 15 base colors, with 16 gradient levels used for each base color in the indicator's gradients.
• A zero line shows a 6-state aggregate value of the three main volume balance modes.
• The background can be colored using any of 4 different methods.
• Chart bars can be colored using 5 different methods.
• Divergence and neutral volume events can be shown in either Columns or Line mode, calculated in one of 4 different methods.
• Markers on 5 different conditions can be displayed.


Intrabar inspection
Intrabar inspection means the indicator looks at lower timeframe bars making up a given chart bar to gather a finer level of detail on its constituent volume , dividing it into buy/sell/neutral categories by looking at price movement during intrabars.

Volume Balances and calculation methods
This indicator uses a variety of methods to evaluate volume balance and to derive other calculations from those volume balances. As it has the luxury of distinct buy/sell volume information, all volume averages used internally are calculated separately for buy and sell sides.
1 — Volume Balance on Bar: Uses the relative importance of instant buy/sell volume on the bar.
2 — Volume Balance Average: Uses the difference between the EMAs of buy and sell volume .
3 — Volume Balance Momentum: Starts by calculating, separately for both buy and sell volumes, the difference between the same EMAs used in the previous mode and an SMA of double the period used for the EMA . These differences are then aggregated and finally, a bounded momentum of that aggregate is calculated using RSI so that a +/- percentage around the 50 centerline can be derived.
4 — Marker Bias: It sums the bull/bear occurrences of the four other markers over a user-defined period (the default is 14).
5 — Combined Balances: This is the aggregate of the instant bull/bear bias of the three volume balances.
6 — Dual Buy/Sell Averages: This is a display mode showing the two EMAs calculated for buy and sell volume .


1 — Columns
• While the size of the buy/sell columns always represents their respective importance on the bar, their coloring mode is independent. The default setup uses a standard coloring mode where the buy/sell columns over/under the zero line are always in the bull/bear color with a higher intensity for the winning side. Six other coloring modes allow you to pack more information in the columns. When choosing to color the top columns using a bull/bear gradient on Volume Balance Averages, for example, you will end up with bull/bear colored tops. In order for the color of the bottom columns to continue to show the instant bar balance, you can then choose the "Buy/Sell Ratio on Bar — Dual Solid Colors" coloring mode to make those bars the color of the winning side for that bar.
• Line mode shows only the line, but Columns mode allows displaying the line along with it. The scale of the line being different than the scale of the columns, the line will often appear flat on the columns' zero line. The exceptions are the "Volume Balance on Bar" and the "Dual Buy/Sell Averages" Line calculation modes, which use the same scale as volume . Traders may find even a flat line useful as its bull/bear colors will be easily distinguishable.

2 — Line
• The default setup for Line mode uses a calculation on the long-term "Volume Balance Averages", with a fill on the medium-term "Volume Balance Momentum" and a line color based on the immediacy of the "Volume Balance on Bar". With the background set on "Marker Bias" and the zero line on its hard-coded "Combined Volume Balances", you have access to 5 different components, to which you can add divergences, divergences levels and chart bar coloring. This provides powerful potential in displaying delta volume information.
• When no columns are displayed, Line mode can show the full scale of whichever line you choose to calculate because the columns' scale no longer interferes with the line's scale.
• Note that when "Volume Balance on Bar" is selected, neutral volume is also displayed. This is the only instance where neutral volume is displayed in Line mode.
• The "Dual Buy/Sell Averages" is an exception as it displays two lines: one average for the buy volume and another for sell volume . This mode will be most useful when Columns are also displayed, as it provides a reference for the top and bottom columns.

3 — Zero Line
The zero line can be colored using two methods, both based on the Combined Balances, i.e., the aggregate of the instant bull/bear bias of the three volume balances.
• In "Six-state Dual Color Gradient" mode, a dot appears on every bar. Its color reflects the bull/bear state of the Combined Balances, and the dot's brightness reflects the tally of balance biases.
• In "Dual Solid Colors (All Bull/All Bear Only)" a dot only appears when all three balances are either bullish or bearish . The resulting pattern is identical to that of Marker #1.

4 — Divergences
• Divergences are displayed as a small circle at the top of the scale. Four different types of divergence events can be detected. Divergences occur whenever the bull/bear bias of the method used diverges with the bar's price direction.
• Neutral volume occurrences can be added to divergence events.
• The divergence levels are dynamic levels that automatically build from the Line's values on divergence events. On consecutive divergences, the levels will expand, creating a channel. This implementation of the divergence levels corresponds to my view that divergences indicate anomalies, hesitations, points of uncertainty if you will. It excludes any association of a pre-determined bullish / bearish bias to divergences. Accordingly, the levels merely take note of divergence events and mark those points in time with levels. Traders then have a reference point from which they can evaluate further movement. The bull/bear/neutral colors used to plot the levels are also congruent with this view in that they are determined by price's position relative to the levels, which is how I think divergences can be put to the most effective use.

5 — Background
• The background can show a bull/bear gradient on four different calculations. You can adjust its brightness to make its importance proportional to how you use it in your analysis.

6 — Chart bars
• Chart bars can be colored using five different methods.
• You have the option of emptying the body of bars where volume does not increase, as does my TLD indicator.

7 — Intrabar Resolution
You can choose between three modes. Two of them are automatic and one is manual:
  a) Fast Auto-Steps: Optimized for speed and deeper history.
  b) More Precise Auto-Steps: Uses finer intrabar resolution. It is slower and provides less history.
  c) FIxed: Uses the fixed resolution of your choice.
You can also choose to view the intrabar resolution currently used to calculate delta volume .
The proper selection of the intrabar resolution is important. It must achieve maximal granularity to produce precise results while not unduly slowing down calculations, or worse, causing runtime errors.

8 — Total Volume Discrepancies
• Stock exchanges do not report the same volume for intraday and daily (or higher) resolutions. This will often cause discrepancies between the total volume calculated using intraday and daily bars. Unless the additional volume information available on daily charts upsets the delta volume balance, this will not invalidate the information displayed by the indicator. A mechanism to detect intraday and daily volume discrepancies is nonetheless provided. It allows you to define a threshold percentage above which the background will indicate a difference has been detected.
• You can choose to display a neutral gray realtime volume bar.

9 — Markers
Five markers are available:
Combined Balances Agreement: All three Volume Balances are either bullish or bearish .
Double Bumps: Two volume bumps in a row, accompanied by successive closes in the same direction as the two bumps. A bump up is defined as an up bar with increasing bullish volume balance higher than its average as calculated using the "Dual Buy/Sell Average".
Divergence confirmations: One of the four types of volume balance calculations can be used to detect divergences with price. Confirmations occur when the bar following the divergence confirms the volume balance bias.
Volume Balance Shifts: These are bull/bear transitions of one of three volume balances.
Marker Bias: It sums the bull/bear occurrences of the four other markers over a user-defined period (the default is 14). This forms the Markers Bias.
Markers appear when the required condition has been confirmed on the previous bar. Since nothing is plotted in realtime, markers do not appear on the realtime bar.

10 — Periods
• Allows control over the periods of the different moving averages used in calculations.
• The periods used for the various calculations define the following hierarchy from slow to fast: Volume Balance Average (100), Dual Buy/Sell Averages (50), Volume Balance Momentum and Marker Bias (14). You may, of course, adjust these any way you please.


• This script uses a special characteristic of the `security()` function allowing the inspection of intrabars—which is not officially supported by TradingView. It has the advantage of permitting a more robust calculation of delta volume than other methods but also has its limits.
• The method used does not work on the realtime bar—only on historical bars.
• The indicator only works on some chart resolutions: 3, 5, 10, 15 and 30 minutes, 1, 2, 4, 6, and 12 hours, 1 day, 1 week and 1 month. The script’s code can be modified to run on other resolutions, but chart resolutions must be divisible by the lower resolution used for intrabars and the stepping mechanism could require adaptation.
• When the difference between the chart’s resolution and the intrabar resolution is too great, runtime errors will occur. The Auto-Steps selection mechanisms should avoid this.
• Alerts do not work reliably when `security()` is used at intrabar resolutions. Accordingly, no alerts are configured in the indicator.
• Not all markets have volume information. Without it, this indicator is useless. All volume is not created equally. Its source, components, quality and reliability will vary considerably with sectors and instruments. The higher the quality, the more reliably delta volume information can be used to guide your decisions. You should make it your responsibility to understand the volume information provided in the data feeds you use. It will help you make the most of delta volume information.
• The color model used in the indicator provides for fancy visuals that come at a price; when you change values in Inputs, it can take 20 seconds for the changes to materialize. Luckily, once your color setup is complete, the color model does not have a large performance impact , as in normal operation the `security()` calls will become the most important factor in determining response time. Also, once in a while a runtime error will occur when you change inputs. Just making another change will usually bring the indicator back up.


On Delta Volume
Volume is arguably the best complement to interpret price action. In periods of low-volatility price consolidations, volume will typically also be lower than normal. Even so, slight imbalances in the trend of the buy/sell volume balance can sometimes help put early odds on the direction of the break from consolidation. Additionally, the progression of the volume imbalance can help determine the proximity of the breakout.
I also find volume balance and the number of divergences very useful to evaluate the strength of trends. In trends, I am looking for "slow and steady", i.e., relatively low volatility and pauses where price action doesn't look like world affairs are being reassessed. In my personal mythology, this type of trend is often more resilient than high-volatility breakouts, especially when volume balance confirms the general agreement of traders signaled by the low-volatility usually accompanying this type of trend. The volume action on pauses will often help me decide between aggressively taking profits, tightening a stop or going for a longer-term movement.
As for reversals, they generally occur in high-volatility areas where entering trades is more expensive and riskier. While the identification of reversals fascinates many traders to no end, they represent poor opportunities in my view. Volume imbalances often precede reversals, but I prefer to use delta volume information to identify the areas following reversals where I can confirm them and make relatively low-cost entries with better odds.

On "Buy/Sell" Volume
Buying or selling volume are misnomers, as every unit of volume transacted is both bought and sold by 2 different traders. While this does not keep me from using the terms, there is no such thing as “buy only” or “sell only” volume . Trader lingo is riddled with peculiarities.
Without access to order book information, traders work with the assumption that when price moves up during a bar, there was more buying pressure than selling pressure. The built-in volume indicator available on TradingView uses this logic to color the volume columns green or red. While this script’s numbers are more precise because it analyses a number of intrabars to calculate its information and takes neutral volume into account, it uses the exact same imperfect logic. Until Pine scripts can have access to how much volume was transacted at the bid/ask prices, our delta volume information will be a mere proxy.

Most of the divergence detection methods used here rely on a difference between the bias of a calculation involving a multi-bar average and a given bar's price direction. When using "Volume Balance on Bar" however, only the bar's volume balance and price are used. You may wonder how there can be divergences between buying/selling volume information and price movement on one bar. This will sometimes be due to the methodology’s shortcomings we have just discussed, but divergences may also occur in instances where because of order book structure, it takes less volume to increase the price of an asset than it takes to decrease it.
As usual, divergences are points of interest because they reveal imbalances, which may or may not become turning points. I do not share the overwhelming enthusiasm traders have for divergences. To your pattern-hungry brain, the divergences displayed by this indicator will—as they do on other indicators—appear to often indicate turnarounds. My opinion is that reality is generally quite sobering and I have no reliable information that would tend to prove otherwise. Exercise caution when using them.

In "The Bed of Procrustes", Nassim Nicholas Taleb writes: To bankrupt a fool, give him information. Delta Volume Columns Pro can display lots of information. While learning to use a new indicator inevitably requires an adaptation period where we put it through its paces and try out all its options, once you have become used to Delta Volume Columns Pro and decide to adopt it, rigorously eliminate the components you don't use and configure the remaining ones so their visual prominence reflects their relative importance in your analysis. I tried to provide flexible options for traders to control this indicator's visuals for that exact reason—not for window dressing.


For traders
• To prevent misleading users who don't read script descriptions, I decided to show absolutely nothing in the realtime bar, safe for normal volume in the Data Window. There is an option under the "Total Volume Discrepancies" section of Inputs to show realtime volume in a neutral gray color. When using it on chart resolutions >=1D on markets like stocks where daily and intrabar volume varies, the scale of realtime volume can be much greater than that of the intrabar, stacked delta volume .
• The Data Window shows key values for the indicator.
• While this indicator displays some of the same information calculated in my Delta-Volume-Columns, I have elected to make it a separate publication so that traders continue to have a simpler alternative available to them. Both code bases will continue to evolve separately.
• All gradients used in this indicator determine their brightness intensities using advances/declines in the signal—not their relative position in a pre-determined scale.
• Most of the volume data used by the indicator being relative, this makes it particularly well suited to Forex markets, as it filters out quite elegantly the cyclical volume data characterizing the sector.

For coders
• For those interested in gradients, this script uses an advanced version of the Advance/Decline gradient function from the PineCoders Color Gradient (16 colors) Framework. It allows more precise control over the range, steps and min/max values of the gradients.
• I use the PineCoders Coding Conventions for Pine to write my scripts.
• I used functions modified from the PineCoders MTF Selection Framework for the selection of timeframes.


— A guy called Kuan who commented on a Backtest Rookies presentation of their Volume Profile indicator using a `for` loop.
 The heart of my Delta Volume Columns Pro indicator is code borrowed from Kuan; I just built a hopefully useful wrapper around it.
theheirophant, my partner in the exploration of the sometimes weird abysses of `security()`’s behavior at lower resolutions.
midtownsk8rguy, my brilliant companion in mining the depths of Pine graphics. He is also the co-author of the PineCoders Color Gradient Frameworks.
Release Notes: v1.1: Updated comments.
Release Notes: v1.2: Cosmetic fixes and streamlining of comments.
Release Notes: v1.3:
— I improved the Auto-Steps intrabar resolution logic. The 2 Auto-Steps modes now calculate the intrabar resolution to guarantee a minimum of 12 or 24 intrabars. The default is 24. Additionally, the logic takes into account whether your chart is running on conventional or 24/7 markets, modulating the intrabar resolution as needed so the minimum required quantity of intrabars is used.
— I brought down the default period for the Volume Balance Averages from 100 to 50.
— Fixed a minor oversight that caused divergence lines to plot in the realtime bar.

This indicator has become a mainstay on my charts. I like to use it with my Bar Balance, as that indicator only looks at price.

Always manage risk first. If you are learning, do not let the inevitable costs of learning ruin you. Make the smallest bets your broker/exchange will allow, so you can lose on hundreds or thousands of trades over a few years and still be able to trade and quietly focus on learning. Record EVERYTHING: your numbers, your thoughts, your experiences and your feelings. As Lionel Shriver writes: "Be leery of orthodoxy. Hold back from shared cultural enthusiasms." Be your own trader. Read others if you want, but figure out things for yourself. When working, sit straight and relaxed. Breathe! Be both ruthless and gentle with yourself. Go slow. Know your tools inside and out. Relentlessly keep your sights on the big picture. Have fun.
Release Notes: v5.0
This update uses the new color functions in Pine to calculate the gradients one can configure on many components of the indicator.
The script runs faster, but the intrabar inspection still requires some time to calculate.
This also resolves the recent issue where the indicator no longer worked because it exceeded the maximum number of plots allowed.
Another upcoming revision will allow the script to calculate volume​ delta and trigger alerts in realtime.
In the meantime, my Tape indicator can be used to calculate volume​ delta in realtime.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

Tools and ideas for all Pine coders:


500 coins
You are a freaking legend man... I wrote a script to capture the same data... but you just tore my face off lol. Awesome stuff.
+4 Reply
LucF kurtsmock
@kurtsmock, y well yours probably loads 10x faster too ) Thx for the good words. Appreciate.
+3 Reply
Request anyone to make a video on how to use it .
+2 Reply
Thank you all for the good words. It's always very nice to hear from people who appreciate the work, and I sincerely hope this will be useful in your trading.
+1 Reply
+1 Reply
Amazing work as always.
+1 Reply
visually haunting :) and beautiful !!
LucF idrisbengali
Really Really awesome
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out