Intra-bar Volume


I have take and try to improuve the source code of indicator "intra-bar volume" by backtest-rookies.com

This indicator categorized the volume in lower timeframe, if the candle close up it's a buying volume , if it close down...

Beware that is not easy to work with different TF on tradingview so you have some limitation on the TF with this indicator. Also in TV we can't have a mutable variable in a security fonction.. so my approche is not clean but it works, if someone find better way, please comment or contact me :)

So by default the indicator can work on the following TF : 5m 15m 30m 60m 120m 240m 480m 720m 1D 1W 12M.

But ... this indicator need a lower timeframe and the number of bar to work correctly, in my code i suppose that the market run 24/7, so you need to adapte it or use intraday TF for other market.

To make sure that the indicator work correctly i have juste add circle, if it's green the buying+selling+balance volume is equal to the volume on the last close candle. If it's red theire is a problem.

I hope you enjoy it, feel free to modify the code and comment if you have any sugestion, i have just make it so maybe i will ajust some part of the code.
Catatan Pelepasan: Sometime the count volume on lower TF is not the same of the report volume(miss data round data ? ), no impact on the indicator but the control cricle turn red, so i add a tolerence of +-1%.
Catatan Pelepasan: I*ve add a option to stack the buying and selling value to get the same representation as the total volume.
If the buying value is superior or equal to the selling volume the buying volume gone represente the total volume (buy vol + sell vol + balance vol) and the selling value is (blance + sell vol) and it reverse is selling volue is superior to the buying value.
With this you lose the real value of the volume for each type of volume but you get the better reading beaucause the seeling/buying/blance volume proportional to the area of the columns, and more importante you keep the information of the total volume.
Catatan Pelepasan: Ok so this time i have just find a way to work arround the transparence issue, I just to use a other plot and switch the buying volume. No more brown stuff just green red and black.
Catatan Pelepasan: stack volume is now enable by default, and i have change the order fo display for the higher categorie of volume.
Catatan Pelepasan: add precision=0 to get special rules for formatting very large numbers (like volume, e.g. '5183' will be formatted as '5K')
Catatan Pelepasan: I have update the code to allow custom setting for user.

To use it you can check "Use custom value" then the entries bellow will apply. "TF for custom value" is the TF of your chart, by default i have put 1W, and TF to look and Number of candles to "1D" and "5".
So if you are in a weekly chart the indicator will work on 5 daly candles usefull for forex, equities... You can apply only one custom setting for one timeframe, if you switch in a other timeframe the indicator will use hard coded preset.
If you select "Any" that means that the indicator will no longer detect and apply hard coded value but user value all the time.

I have also make a small change in the light check, now it will show "Error" if the total buying, selling and balance volume don't match the volume, keep in mind that it only check le last close candle of you chart and not all the data display. in case of a break of quotation, holiday... the information shown by the indicator can be wrong, but you check manualy by enable "Show classic volume".
Catatan Pelepasan: smal fix for UI.
Catatan Pelepasan:
  • Added 100% buying/ 100% seeling/ balance volume alerts
  • New way to define balance volume, it take into consideration a percentage (5% by defaut so 0.05) of the current high low difference of the intrabar tf.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Rumah. Anda boleh menyukainya untuk menggunakannya pada carta.


Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?