- Choice of color themes for either dark or light chart backgrounds
- Delta columns
- Balance displayed as the difference between the MAs of buying and selling
- Display of divergences between a bar’s balance and the bar’s price movement (example: buying > selling but close < open). Divergences can be shown in 2 different color schemes (including green/red showing a tentative direction), on columns and/or on chart bars
- Display of bar by bar balance with highlighting of above average
- Display of the usual total MA
- Choice of the lower resolution used to retrieve intrabar information
- Alerts configurable on any combination of the markers, with control over long/short direction
- Choice of 3 different markers:
1. Double bumps: two consecutive bars where buying or selling is in the same direction and where > MA
2. Divergence confirmations: direction of the price bar following a price/ balance divergence
3. balance shifts: zero level crossings of the balance MA delta
The chart shows the two main modes of display:
- Top pane: shows the stacked columns with divergences in orange and the flattened balance MAs delta at the bottom of the columns. This balance is the same shown in the bottom pane. The top pane also shows the instant balance strip above the columns. The strip’s colors show which of the buying or selling was greater, and colors are brighter if the total was above the total MA.
- Bottom pane: shows the balance MAs delta with markers 1 and 2. Given that this graphic has no price momentum component, I find quite eerie how it often looks like a momentum-based signal.
The default 5 minute intrabar resolution is used in combination with the weekly chart, which is excessive.
This script uses a special characteristic of the security() function’s behavior when it is sent to a resolution lower than the chart’s resolution. Details are given in the script’s comments. This method has the advantage of working under more circumstances than some of the other loop-based methods, but it also has its limits.
This is what you need to know:
- The method used does not work on the realtime bar—only on historical bars. Consequently, the column shown on the realtime bar is a normal column plotted in green or red, following price movement. The column will only show delta information after it closes and becomes a historical bar.
- The indicator only works on some chart resolutions: 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.
- Intrabar resolutions can be selected from 1, 5, 15, 30, 45 minutes, 1, 2, 3, 4 hours, 1 day, 1 week and 1 month. The intrabar resolution must of course be smaller than the chart’s resolution.
- Contrary to my other indicators where alerts must be configured to trigger “Once Per Bar Close” in order to avoid false triggers (or repainting), all this indicator’s alerts are designed to trigger using previous bar information since the indicator’s calculations in the realtime bar are not exact. Markers are not plotted with a negative offset; they appear at the beginning of the realtime bar following confirmation of the marker’s condition on the previous bar. Alerts for this indicator should thus be configured to trigger “Once Per Bar” so they trigger at the beginning of the realtime bar. Note that the penalty is not that great, as it is simply the instant between the close of the previous realtime bar and the opening of the next. The advantage of using this technique is that the indicator does not repaint; a marker that appears at the beginning of the realtime bar will never disappear.
- The script only plots information that is reliable in the realtime bar, i.e., total and markers. All other plots are set to n/a to prevent misleading traders.
- When the difference between the chart’s resolution and the lower resolution is too important, columns will not calculate for all bars in the dataset.
On Delta Volume
Buying or selling are misnomers, as every unit of transacted is both bought and sold by 2 different traders. There is no such thing as “buy only” or “sell only” , but trader lingo is riddled with original fabulations.
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 indicator available on TradingView uses this logic to color the columns green or red. While this script’s numbers are more precise because it analyses a number of intrabars to calculate its information, it uses the exact same imperfect logic to calculate its buying/selling/neutral sections.
Until Pine scripts can have access to how much was transacted at the bid/ask prices, our so-called buying/selling information will always be a mere proxy.
You may wonder how there can be divergences between buying/selling information and price movement. 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 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 orange bars this indicator shows on chart will—as divergences on other indicators do–appear to often indicate turnarounds. My opinion is that reality is generally quite sobering, as many who have tried building automated rules based on divergences will tell you. I do not have hard numbers on the lack of performance of divergences—only many failed attempts to make them perform, which a few experienced strategy modelers I know share with me. Please don’t try to read too much into them. While they look great on past data, I find they are often difficult to use in realtime to make bets with good odds.
- A guy called Kuan who commented on a Backtest Rookies presentation of an intrabar delta indicator using a for loop. The heart of “my” 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.
I have also deleted the alert code that had been commented out, as no fix can be hoped for in the foreseeable future. Markers are still reliable though.
• The volume columns of the realtime bar, as well as elapsed realtime bars that have not yet been calculated, have been made more visually prominent. You can see some of those elapsed columns to the right of this chart. They are light gray. This was done so that users who do not understand that the indicator only works on historical bars can have a cue as to what's going on.
• Automatically calculated lower intrabar resolutions derived from the chart's resolution can now be selected in one of 2 modes. You can still use a fixed resolution if you wish.
• Markers now show on the bar where they are detected. As they will not show on the realtime bar and cannot be used for alert generation, there was no sense in continuing to delay them on historical bars.
• Support for 3min resolution was added.
• The indicator's Inputs have been streamlined.
• Traders interested in a broader set of calculations and different ways of presenting them may want to look at:
Delta Volume Columns Pro • For an overlay version of Delta Volume, see my:
Delta Volume Candles
I will continue to maintain this simpler code base of Delta Volume Columns, as it already has many users and has the advantage of having Inputs which respond faster than more complex, two other versions above.
Tools and ideas for all Pine coders: http://www.pinecoders.com
I guess I am having a little problem with either interpreting its output or a minor bug occuring.
I noticed that net volume MA is sometimes inconsistent.
For example, volume balance 10 day MA turned to negative two days ago for the symbol BIST:PGSUS. Now, I see as if MA was positive at last two days.
Do you know what is going ?
P.S. : I feel like the same inconsistency goes for columns (daily volume balance) as well. I kind of remember the net balance was red for yesterday's bar, now seems like it was green. I am not certain enough about columns as I have mostly cared about the MA and focus on it.
I appreciate your work.
I have recently started using delta volume columns and it seems like a very nice piece of work. Thanks for sharing it.
TF is 1d.
intrabar resolution is ''more precise'', labeled as 30m on the chart next to columns.
I am using 10 day MA.
I remember MA was negative on both May 8 and May 11, which now seem positive.
UPDATE : I am using heikin ashi bars. my guess is heikin ashi is the reason. what do you think?