โโOVERVIEW
This indicator displays on-chart visuals aimed at making the most of delta โvolume information. It can color bars and display two channels: one for delta โvolume, another calculated from the price levels of bars where delta โvolume divergences occur. Markers and alerts can also be configured using key conditions, and filtered in many different ways. The indicator caters to traders who prefer chart visuals over raw values. It will work on historical bars and in real time, using intrabar analysis to calculate delta โvolume in both conditions.
โโCONCEPTS
Delta Volume
โThe โvolume delta concept divides a bar's โvolume in "up" and "down" โvolumes. The delta is calculated by subtracting down โvolume from up โvolume. Many calculation techniques exist to isolate up and down โvolume within a bar. The simplest techniques use the polarity of interbar price changes to assign their โvolume to up or down slots, e.g., On Balance Volume or the Klinger Oscillator. Others such as Chaikin Money Flow use assumptions based on a bar's OHLC values. The most precise calculation method uses tick data and assigns the โvolume of each tick to the up or down slot depending on whether the transaction occurs at the bid or ask price. While this technique is ideal, it requires huge amounts of data on historical bars, which usually limits the historical depth of charts and the number of symbols for which tick data is available.
This indicator uses intrabar analysis to achieve a compromise between the simplest and most precise methods of calculating โvolume delta. In the context where historical tick data is not yet available on TradingView, intrabar analysis is the most precise technique to calculate โvolume delta on historical bars on our charts. TradingView's Volume Profile built-in indicators use it, as do the CVD - Cumulative โVolume Delta Candles and CVD - Cumulative Volume Delta (Chart) indicators published from the TradingView account. My Volume Delta Columns Pro indicator also uses intrabar analysis. Other โvolume delta indicators such as my Realtime 5D Profile use realtime chart updates to achieve more precise โvolume delta calculations. Indicators of that type cannot be used on historical bars however; they only work in real time.
This is the logic I use to assign intrabar โvolume to up or down slots:
โโข If the intrabar's open and close values are different, their relative position is used.
โโข If the intrabar's open and close values are the same, the difference between the intrabar's close and the previous intrabar's close is used.
โโข As a last resort, when there is no movement during an intrabar and it closes at the same price as the previous intrabar, the last known polarity is used.
Once all intrabars making up a chart bar have been analyzed and the up or down property of each intrabar's โvolume determined, the up volumes are added and the down volumes subtracted. The resulting value is โvolume delta for that chart bar, which can be used as an estimate of the buying/selling pressure on an instrument.
Delta โVolume Percent (DV%)
This value is the proportion that delta โvolume represents of the total intrabar โvolume in the chart bar. Note that on some symbols/timeframes, the total intrabar โvolume may differ from the chart's โvolume for a bar, but that will not affect our calculations since we use the total intrabar โvolume.
Delta โVolume Channel
The โโDV channel is the space between two moving averages: the reference line and a DV%-weighted version of that reference. The reference line is a moving average of a type, source and length which you select. The DV%-weighted line uses the same settings, but it averages the DV%-weighted price source.
The weight applied to the source of the reference line is calculated from two values, which are multiplied: DV% and the relative size of the bar's โvolume in relation to previous bars. The effect of this is that DV% values on bars with higher total โvolume will carry greater weight than those with lesser โvolume.
The โDV channel can be in one of four states, each having its corresponding color:
โโข Bull (teal): The DV%-weighted line is above the reference line.
โโข Strong bull (lime): The bull condition is fulfilled and the bar's close is above the reference line and both the reference and the DV%-weighted lines are rising.
โโข Bear (maroon): The DV%-weighted line is below the reference line.
โโข Strong bear (pink): The bear condition is fulfilled and the bar's close is below the reference line and both the reference and the DV%-weighted lines are falling.
Divergences
In the context of this indicator, a divergence is any bar where the slope of the reference line does not match that of the DV%-weighted line. No directional bias is assigned to divergences when they occur.
Divergence Channel
The divergence channel is the space between two levels (by default, the bar's low and high) saved when divergences occur. When price has breached a channel and a new divergence occurs, a new channel is created. Until that new channel is breached, bars where additional divergences occur will expand the channel's levels if the bar's price points are outside the channel.
Prices breaches of the divergence channel will change its state. Divergence channels can be in one of five different states:
โโข Bull (teal): Price has breached the channel to the upside.
โโข Strong bull (lime): The bull condition is fulfilled and the โDV channel is in the strong bull state.
โโข Bear (maroon): Price has breached the channel to the downside.
โโข Strong bear (pink): The bear condition is fulfilled and the โDV channel is in the strong bear state.
โโข Neutral (gray): The channel has not been breached.
โโHOW TO USE THE INDICATOR
Load the indicator on an active chart (see here if you don't know how).
The default configuration displays:
โโข The โDV channel, without the reference or DV%-weighted lines.
โโข The Divergence channel, without its level lines.
โโข Bar colors using the state of the โDV channel.
The default settings use an Arnaud-Legoux moving average on the close and a length of 20 bars. The DV%-weighted version of it uses a combination of DV% and relative โvolume to calculate the ultimate weight applied to the reference. The DV%-weighted line is capped to 5 standard deviations of the reference. The lower timeframe used to access intrabars automatically adjusts to the chart's timeframe and achieves optimal balance between the number of intrabars inspected in each chart bar, and the number of chart bars covered by the script's calculations.
The Divergence channel's levels are determined using the high and low of the bars where divergences occur. Breaches of the channel require a bar's low to move above the top of the channel, and the bar's high to move below the channel's bottom.
No markers appear on the chart; if you want to create alerts from this script, you will need first to define the conditions that will trigger the markers, then create the alert, which will trigger on those same conditions.
To learn more about how to use this indicator, you must understand the concepts it uses and the information it displays, which requires reading this description. There are no videos to explain it.
โโFEATURES
The script's inputs are divided in four sections: "DV channel", "Divergence channel", "Other Visuals" and "Marker/Alert Conditions". The first setting is the selection method used to determine the intrabar precision, i.e., how many lower timeframe bars (intrabars) are examined in each chart bar. The more intrabars you analyze, the more precise the calculation of DV% results will be, but the less chart coverage can be covered by the script's calculations.
DV Channel
Here, you control the visibility and colors of the reference line, its weighted version, and the DV channel between them.
You also specify what type of moving average you want to use as a reference line, its source and length. This acts as the โDV channel's baseline. The DV%-weighted line is also a moving average of the same type and length as the reference line, except that it will be calculated from the DV%-weighted source used in the reference line. By default, the DV%-weighted line is capped to five standard deviations of the reference line. You can change that value here. This section is also where you can disable the relative โvolume component of the weight.
Divergence Channel
This is where you control the appearance of the divergence channel and the key price values used in determining the channel's levels and breaching conditions. These choices have an impact on the behavior of the channel. More generous level prices like the default low and high selection will produce more conservative channels, as will the default choice for breach prices.
In this section, you can also enable a mode where an attempt is made to estimate the channel's bias before price breaches the channel. When it is enabled, successive increases/decreases of the channel's top and bottom levels are counted as new divergences occur. When one count is greater than the other, a bull/bear bias is inferred from it.
Other Visuals
You specify here:
โโข The method used to color chart bars, if you choose to do so.
โโข The display of a mark appearing above or below bars when a divergence occurs.
โโข If you want raw values to appear in tooltips when you hover above chart bars. The default setting does not display them, which makes the script faster.
โโข If you want to display an information box which by default appears in the lower left of the chart.
โโIt shows which lower timeframe is used for intrabars, and the average number of intrabars per chart bar.
Marker/Alert Conditions
Here, you specify the conditions that will trigger up or down markers. The trigger conditions can include a combination of state transitions of the โDV and the divergence channels. The triggering conditions can be filtered using a variety of conditions.
Configuring the marker conditions is necessary before creating an alert from this script, as the alert will use the marker conditions to trigger.
Markers only appear on bar closes, so they will not repaint. Keep in mind, when looking at markers on historical bars, that they are positioned on the bar when it closes โ NOT when it opens.
Raw values
The raw values calculated by this script can be inspected using a tooltip and the Data Window. The tooltip is visible when you hover over the top of chart bars. It will display on the last 500 bars of the chart, and shows the values of โDV, DV%, the combined weight, and the intermediary values used to calculate them.
โโINTERPRETATION
The aim of the โDV channel is to provide a visual representation of the buying/selling pressure calculated using delta โvolume. The simplest characteristic of the channel is its bull/bear state. One can then distinguish between its bull and strong bull states, as transitions from strong bull to bull states will generally happen when buyers are losing steam. While one should not infer a reversal from such transitions, they can be a good place to tighten stops. Only time will tell if a reversal will occur. One or more divergences will often occur before reversals.
The nature of the divergence channel's design makes it particularly adept at identifying consolidation areas if its settings are kept on the conservative side. A gray divergence channel should usually be considered a no-trade zone. More adventurous traders can use the โDV channel to orient their trade entries if they accept the risk of trading in a neutral divergence channel, which by definition will not have been breached by price.
If your charts are already busy with other stuff you want to hold on to, you could consider using only the chart bar coloring component of this indicator:

At its simplest, one way to use this indicator would be to look for overlaps of the strong bull/bear colors in both the โDV channel and a divergence channel, as these identify points where price is breaching the divergence channel when buy/sell pressure is consistent with the direction of the breach. I have highlighted all those points in the chart below. Not all of them would have produced profitable trades, but nothing is perfect in the markets. Also, keep in mind that the circles identify the visual you would be looking for โ not the trade's entry level.

โโLIMITATIONS
โโข The script will not work on symbols where no โvolume is available. An error will appear when that is the case.
โโข Because a maximum of 100K intrabars can be analyzed by a script, a compromise is necessary between the number of intrabars analyzed per chart bar
โโand chart coverage. The more intrabars you analyze per chart bar, the less coverage you will obtain.
โโThe setting of the "Intrabar precision" field in the "DV channel" section of the script's inputs
โโis where you control how the lower timeframe is calculated from the chart's timeframe.
โโNOTES
Volume Quality
If you use โvolume, it's important to understand its nature and quality, as it varies with sectors and instruments. My Volume X-ray indicator is one way you can appraise the quality of an instrument's intraday โvolume.
For Pine Scriptโข Coders
โโข This script uses the new overload of the fill() function which now makes it possible to do vertical gradients in Pine. I use it for both channels displayed by this script.
โโข I use the new arguments for plot()'s `display` parameter to control where the script plots some of its values,
โโnamely those I only want to appear in the script's status line and in the Data Window.
โโข I wrote my script using the revised recommendations in the Style Guide from the Pine v5 User Manual.
โโTHANKS
To PineCoders. I have used their lower_tf library in this script, to manage the calculation of the LTF and intrabar stats, and their Time library to convert a timeframe in seconds to a printable form for its display in the Information box.
To TradingView's Pine Scriptโข team. Their innovations and improvements, big and small, constantly expand the boundaries of the language. What this script does would not have been possible just a few months back.
And finally, thanks to all the users of my scripts who take the time to comment on my publications and suggest improvements. I do not reply to all but I do read your comments and do my best to implement your suggestions with the limited time that I have.
This indicator displays on-chart visuals aimed at making the most of delta โvolume information. It can color bars and display two channels: one for delta โvolume, another calculated from the price levels of bars where delta โvolume divergences occur. Markers and alerts can also be configured using key conditions, and filtered in many different ways. The indicator caters to traders who prefer chart visuals over raw values. It will work on historical bars and in real time, using intrabar analysis to calculate delta โvolume in both conditions.
โโCONCEPTS
Delta Volume
โThe โvolume delta concept divides a bar's โvolume in "up" and "down" โvolumes. The delta is calculated by subtracting down โvolume from up โvolume. Many calculation techniques exist to isolate up and down โvolume within a bar. The simplest techniques use the polarity of interbar price changes to assign their โvolume to up or down slots, e.g., On Balance Volume or the Klinger Oscillator. Others such as Chaikin Money Flow use assumptions based on a bar's OHLC values. The most precise calculation method uses tick data and assigns the โvolume of each tick to the up or down slot depending on whether the transaction occurs at the bid or ask price. While this technique is ideal, it requires huge amounts of data on historical bars, which usually limits the historical depth of charts and the number of symbols for which tick data is available.
This indicator uses intrabar analysis to achieve a compromise between the simplest and most precise methods of calculating โvolume delta. In the context where historical tick data is not yet available on TradingView, intrabar analysis is the most precise technique to calculate โvolume delta on historical bars on our charts. TradingView's Volume Profile built-in indicators use it, as do the CVD - Cumulative โVolume Delta Candles and CVD - Cumulative Volume Delta (Chart) indicators published from the TradingView account. My Volume Delta Columns Pro indicator also uses intrabar analysis. Other โvolume delta indicators such as my Realtime 5D Profile use realtime chart updates to achieve more precise โvolume delta calculations. Indicators of that type cannot be used on historical bars however; they only work in real time.
This is the logic I use to assign intrabar โvolume to up or down slots:
โโข If the intrabar's open and close values are different, their relative position is used.
โโข If the intrabar's open and close values are the same, the difference between the intrabar's close and the previous intrabar's close is used.
โโข As a last resort, when there is no movement during an intrabar and it closes at the same price as the previous intrabar, the last known polarity is used.
Once all intrabars making up a chart bar have been analyzed and the up or down property of each intrabar's โvolume determined, the up volumes are added and the down volumes subtracted. The resulting value is โvolume delta for that chart bar, which can be used as an estimate of the buying/selling pressure on an instrument.
Delta โVolume Percent (DV%)
This value is the proportion that delta โvolume represents of the total intrabar โvolume in the chart bar. Note that on some symbols/timeframes, the total intrabar โvolume may differ from the chart's โvolume for a bar, but that will not affect our calculations since we use the total intrabar โvolume.
Delta โVolume Channel
The โโDV channel is the space between two moving averages: the reference line and a DV%-weighted version of that reference. The reference line is a moving average of a type, source and length which you select. The DV%-weighted line uses the same settings, but it averages the DV%-weighted price source.
The weight applied to the source of the reference line is calculated from two values, which are multiplied: DV% and the relative size of the bar's โvolume in relation to previous bars. The effect of this is that DV% values on bars with higher total โvolume will carry greater weight than those with lesser โvolume.
The โDV channel can be in one of four states, each having its corresponding color:
โโข Bull (teal): The DV%-weighted line is above the reference line.
โโข Strong bull (lime): The bull condition is fulfilled and the bar's close is above the reference line and both the reference and the DV%-weighted lines are rising.
โโข Bear (maroon): The DV%-weighted line is below the reference line.
โโข Strong bear (pink): The bear condition is fulfilled and the bar's close is below the reference line and both the reference and the DV%-weighted lines are falling.
Divergences
In the context of this indicator, a divergence is any bar where the slope of the reference line does not match that of the DV%-weighted line. No directional bias is assigned to divergences when they occur.
Divergence Channel
The divergence channel is the space between two levels (by default, the bar's low and high) saved when divergences occur. When price has breached a channel and a new divergence occurs, a new channel is created. Until that new channel is breached, bars where additional divergences occur will expand the channel's levels if the bar's price points are outside the channel.
Prices breaches of the divergence channel will change its state. Divergence channels can be in one of five different states:
โโข Bull (teal): Price has breached the channel to the upside.
โโข Strong bull (lime): The bull condition is fulfilled and the โDV channel is in the strong bull state.
โโข Bear (maroon): Price has breached the channel to the downside.
โโข Strong bear (pink): The bear condition is fulfilled and the โDV channel is in the strong bear state.
โโข Neutral (gray): The channel has not been breached.
โโHOW TO USE THE INDICATOR
Load the indicator on an active chart (see here if you don't know how).
The default configuration displays:
โโข The โDV channel, without the reference or DV%-weighted lines.
โโข The Divergence channel, without its level lines.
โโข Bar colors using the state of the โDV channel.
The default settings use an Arnaud-Legoux moving average on the close and a length of 20 bars. The DV%-weighted version of it uses a combination of DV% and relative โvolume to calculate the ultimate weight applied to the reference. The DV%-weighted line is capped to 5 standard deviations of the reference. The lower timeframe used to access intrabars automatically adjusts to the chart's timeframe and achieves optimal balance between the number of intrabars inspected in each chart bar, and the number of chart bars covered by the script's calculations.
The Divergence channel's levels are determined using the high and low of the bars where divergences occur. Breaches of the channel require a bar's low to move above the top of the channel, and the bar's high to move below the channel's bottom.
No markers appear on the chart; if you want to create alerts from this script, you will need first to define the conditions that will trigger the markers, then create the alert, which will trigger on those same conditions.
To learn more about how to use this indicator, you must understand the concepts it uses and the information it displays, which requires reading this description. There are no videos to explain it.
โโFEATURES
The script's inputs are divided in four sections: "DV channel", "Divergence channel", "Other Visuals" and "Marker/Alert Conditions". The first setting is the selection method used to determine the intrabar precision, i.e., how many lower timeframe bars (intrabars) are examined in each chart bar. The more intrabars you analyze, the more precise the calculation of DV% results will be, but the less chart coverage can be covered by the script's calculations.
DV Channel
Here, you control the visibility and colors of the reference line, its weighted version, and the DV channel between them.
You also specify what type of moving average you want to use as a reference line, its source and length. This acts as the โDV channel's baseline. The DV%-weighted line is also a moving average of the same type and length as the reference line, except that it will be calculated from the DV%-weighted source used in the reference line. By default, the DV%-weighted line is capped to five standard deviations of the reference line. You can change that value here. This section is also where you can disable the relative โvolume component of the weight.
Divergence Channel
This is where you control the appearance of the divergence channel and the key price values used in determining the channel's levels and breaching conditions. These choices have an impact on the behavior of the channel. More generous level prices like the default low and high selection will produce more conservative channels, as will the default choice for breach prices.
In this section, you can also enable a mode where an attempt is made to estimate the channel's bias before price breaches the channel. When it is enabled, successive increases/decreases of the channel's top and bottom levels are counted as new divergences occur. When one count is greater than the other, a bull/bear bias is inferred from it.
Other Visuals
You specify here:
โโข The method used to color chart bars, if you choose to do so.
โโข The display of a mark appearing above or below bars when a divergence occurs.
โโข If you want raw values to appear in tooltips when you hover above chart bars. The default setting does not display them, which makes the script faster.
โโข If you want to display an information box which by default appears in the lower left of the chart.
โโIt shows which lower timeframe is used for intrabars, and the average number of intrabars per chart bar.
Marker/Alert Conditions
Here, you specify the conditions that will trigger up or down markers. The trigger conditions can include a combination of state transitions of the โDV and the divergence channels. The triggering conditions can be filtered using a variety of conditions.
Configuring the marker conditions is necessary before creating an alert from this script, as the alert will use the marker conditions to trigger.
Markers only appear on bar closes, so they will not repaint. Keep in mind, when looking at markers on historical bars, that they are positioned on the bar when it closes โ NOT when it opens.
Raw values
The raw values calculated by this script can be inspected using a tooltip and the Data Window. The tooltip is visible when you hover over the top of chart bars. It will display on the last 500 bars of the chart, and shows the values of โDV, DV%, the combined weight, and the intermediary values used to calculate them.
โโINTERPRETATION
The aim of the โDV channel is to provide a visual representation of the buying/selling pressure calculated using delta โvolume. The simplest characteristic of the channel is its bull/bear state. One can then distinguish between its bull and strong bull states, as transitions from strong bull to bull states will generally happen when buyers are losing steam. While one should not infer a reversal from such transitions, they can be a good place to tighten stops. Only time will tell if a reversal will occur. One or more divergences will often occur before reversals.
The nature of the divergence channel's design makes it particularly adept at identifying consolidation areas if its settings are kept on the conservative side. A gray divergence channel should usually be considered a no-trade zone. More adventurous traders can use the โDV channel to orient their trade entries if they accept the risk of trading in a neutral divergence channel, which by definition will not have been breached by price.
If your charts are already busy with other stuff you want to hold on to, you could consider using only the chart bar coloring component of this indicator:
At its simplest, one way to use this indicator would be to look for overlaps of the strong bull/bear colors in both the โDV channel and a divergence channel, as these identify points where price is breaching the divergence channel when buy/sell pressure is consistent with the direction of the breach. I have highlighted all those points in the chart below. Not all of them would have produced profitable trades, but nothing is perfect in the markets. Also, keep in mind that the circles identify the visual you would be looking for โ not the trade's entry level.
โโLIMITATIONS
โโข The script will not work on symbols where no โvolume is available. An error will appear when that is the case.
โโข Because a maximum of 100K intrabars can be analyzed by a script, a compromise is necessary between the number of intrabars analyzed per chart bar
โโand chart coverage. The more intrabars you analyze per chart bar, the less coverage you will obtain.
โโThe setting of the "Intrabar precision" field in the "DV channel" section of the script's inputs
โโis where you control how the lower timeframe is calculated from the chart's timeframe.
โโNOTES
Volume Quality
If you use โvolume, it's important to understand its nature and quality, as it varies with sectors and instruments. My Volume X-ray indicator is one way you can appraise the quality of an instrument's intraday โvolume.
For Pine Scriptโข Coders
โโข This script uses the new overload of the fill() function which now makes it possible to do vertical gradients in Pine. I use it for both channels displayed by this script.
โโข I use the new arguments for plot()'s `display` parameter to control where the script plots some of its values,
โโnamely those I only want to appear in the script's status line and in the Data Window.
โโข I wrote my script using the revised recommendations in the Style Guide from the Pine v5 User Manual.
โโTHANKS
To PineCoders. I have used their lower_tf library in this script, to manage the calculation of the LTF and intrabar stats, and their Time library to convert a timeframe in seconds to a printable form for its display in the Information box.
To TradingView's Pine Scriptโข team. Their innovations and improvements, big and small, constantly expand the boundaries of the language. What this script does would not have been possible just a few months back.
And finally, thanks to all the users of my scripts who take the time to comment on my publications and suggest improvements. I do not reply to all but I do read your comments and do my best to implement your suggestions with the limited time that I have.
Release Notes
v2Fixed typos in comments.
Release Notes
v3Improved some input tooltips and code aesthetics. No functional changes.
Release Notes
v4โข Reorganized the script's settings.
โข Refactored minor bits of code.
โข The tooltip showing raw values when you hover over the top of bars has been disabled by default because the script will be faster this way. You can enable them in the "Other Visuals" section of the inputs.
Release Notes
v5Seconds intrabars
The script can now access seconds intrabar timeframes to calculate Delta Volume, which means that you can use it on small timeframes such as 1min or 30sec, where it will typically use 1sec intrabars. The intrabar timeframe used on a given symbol and timeframe will be calculated automatically for you, using one of ten preferences you can select from in the "Intrabars (LTF)" section of the script's inputs. The default setting attempts to obtain ~50 intrabars. Note that the actual number of intrabars will vary depending on whether the market is a 24H market or not, and its liquidity. Active markets are more likely to generate enough intrabars.
The information box appearing by default in the lower-right corner of the display was improved. In addition to the intrabar timeframe used, it displays the average number of intrabars discovered per chart bar, and the percentage of historical chart bars covered by calculations. As usual, the limit of 100K intrabars accessible by the script means that the more precise your calculations are because you are using more intrabars, the less chart bars the calculations will cover.
When less than 5 intrabars exist for chart bars, a warning will appear in the information box and its background will become red to indicate that calculations are not very reliable then.
Other changes
โข Some functions local to the script were eliminated by using calls to those of my "ta" library.
โข The information box displays more information than before.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
"The stock market is a device for transferring money from the impatient to the patient."
โ Buffet
tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
โ Buffet
tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
"The stock market is a device for transferring money from the impatient to the patient."
โ Buffet
tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
โ Buffet
tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
