LucF

Delta Volume Columns [LucF]

Displays delta volume columns using intrabar volume information. Each volume column is divided into three sections: buying, selling and neutral volume . Volume for each section is determined from the volume and price movement of each intrabar at a user-selected lower resolution.

Features include:
- Choice of color themes for either dark or light chart backgrounds
- Delta volume columns
- Volume Balance displayed as the difference between the MAs of buying and selling volume
- Display of divergences between a bar’s volume balance and the bar’s price movement (example: buying volume > selling volume but close < open). Divergences can be shown in 2 different color schemes (including green/red showing a tentative direction), on volume columns and/or on chart bars
- Display of bar by bar volume balance with highlighting of above average volume
- Display of the usual total volume 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 volume is in the same direction and where volume > volume MA
2. Divergence confirmations: direction of the price bar following a price/ volume balance divergence
3. Volume balance shifts: zero level crossings of the volume balance MA delta

The chart shows the two main modes of display:
- Top pane: shows the stacked volume columns with divergences in orange and the flattened volume balance MAs delta at the bottom of the volume columns. This volume balance is the same shown in the bottom pane. The top pane also shows the instant volume balance strip above the volume columns. The strip’s colors show which of the buying or selling volume was greater, and colors are brighter if the total volume was above the total volume MA.
- Bottom pane: shows the volume 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.


IMPORTANT
This is what you need to know:
- The method used does not work on the realtime bar—only on historical bars. Consequently, the volume column shown on the realtime bar is a normal volume column plotted in green or red, following price movement. The column will only show delta volume 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 volume 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, volume columns will not calculate for all bars in the dataset.

On Delta Volume
Buying or selling volume are misnomers, as every unit of volume transacted is both bought and sold by 2 different traders. There is no such thing as “buy only” or “sell only” volume , 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 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, it uses the exact same imperfect logic to calculate its buying/selling/neutral sections.
Until Pine scripts can have access to how much volume was transacted at the bid/ask prices, our so-called buying/selling volume information will always be a mere proxy.

Divergences
You may wonder how there can be divergences between buying/selling volume 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 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 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.

Thanks to:
- A guy called Kuan who commented on a Backtest Rookies presentation of an intrabar delta volume 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.
릴리즈 노트: Updated comments and improved display on unsupported chart resolutions.
릴리즈 노트: Disabled alerts. While plotted markers are reliable, alerts configured to trigger "Once Per Bar" are not.
릴리즈 노트: Using "security()" on intrabars is not recommended by TradingView. While it works OK for this indicator most of the time, on charts for stocks at 1D and more, intrabar volume calculations are not reliable. I have introduced a volume calculation failure detection which is on by default and displays a red background when the sum of intrabar volume is off by a user-defined percentage. Failures will occasionally occur on other types of instruments and resolutions. This segment of a BTCUSD chart shows one such failure in the middle of the chart.

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.
릴리즈 노트: v 1.5
• 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.
즐겨찾기 스크립트에서 빼기 즐겨찾기 스크립트에 넣기
"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

Tools and ideas for all Pine coders: http://www.pinecoders.com

코멘트

Excellent! Do you think this is a good alternative to that Mbox cumulative delta indicator?
+1 응답
LucF AlexMihail
@AlexMihail, Sry but I've never used it, so have no idea.
응답
@LucF, https://mboxwave.com/mcumulativedelta-indicator

How would one get this indicator to perform more like this?
응답
LucF AlexMihail
@AlexMihail, Yes, I know of it but never used it. From what I can tell it does, that indie is running on platforms with tick data and access to bid/ask volume, so because of the reasons I explain in the description, it can't be done the same way here, on TV. With this caveat in mind, there are a few ways to obtain some of the same info on TV. That indie's histogram is similar to the Volume Balance MA delta from this indicator. As complements in a Pane, you can look up my mod of LazyBear's Weis Wave and my Ord Volume. For on chart info, you can use VPSV, the built-in Volume Profile by Session, which doesn't work the same way the mbox does at all, but provides some of its info in an indirect way, by showing volume/price points of control. It will be much faster that some of the other Pine indies on TV trying to do the same thing.
응답
LucF AlexMihail
@AlexMihail, I could use the same info this script calculates and render it on a chart in a way that looks like the mbox thing, but it wouldn't improve the exactness of the underlying numbers. Could be a worthwhile future project, but I already have 2 in the queue here and another for PineCoders, and I'm a very slow coder ) so don't think it will be for soon, but I will keep this in mind.
응답
LucF AlexMihail
@AlexMihail, Hi, In case you're not aware of it, might want to have a look at this thing. It's using the same delta volume information as in here, but mapping it on candles. It doesn't do boxes like Mbox, but I've implemented divergence levels in there that have good potential, I believe.
응답
@LucF, wow nice man! I'll take a look. :)
응답
Hello @LucF

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.
응답
LucF gsecer
@gsecer, I can see if I can reproduce your problem. What TF are you using for the chart and the intrabar resolution? And what are the dates/times of the places where you think you are seeing anomalies?
응답
@LucF, thank you.
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?
응답
홈으로 스탁 스크리너 포렉스 스크리너 크립토 스크리너 이코노믹 캘린더 사용안내 차트 특징 프라이싱 프렌드 리퍼하기 하우스룰(내부규정) 헬프 센터 웹사이트 & 브로커 솔루션 위젯 차팅 솔루션 라이트웨이트 차팅 라이브러리 블로그 & 뉴스 트위터
프로화일 프로화일설정 계정 및 빌링 리퍼드 프렌즈 코인 나의 서포트 티켓 헬프 센터 공개아이디어 팔로어 팔로잉 비밀메시지 채팅 로그아웃