Volume Profile: Intra-bar Volume

‎35396‎ مشاهدة
This indicator was developed as part of a free blog post tutorial on the Backtest-Rookies website for detailed code commentary, head over there.


The indicator shall attempt to do the following:

  • Look at a lower time-frame. E.g 5 minutes when on a 1-hour chart.
  • Create a function to loop through through candles and make an assessment.
  • If the candle it closed up, the volume will be categorized as buying volume . Conversely, if it closed down, the volume will be categorized as selling volume
  • The function will then be passed to the security() function to run on a lower timeframe.
  • All buying volume and selling volume from the lower time-frame shall be summed and displayed on the main chart.

Important Note
This indicator will not give you genuine buying or selling volume . It simply follows the assumption that if price closed up, there must have been more buyers than sellers and if it closed down we assume the opposite.


In order to use this indicator, users will need to calculate how many lower time-frame bars are contained in the time-frame on the main chart. So for example, the default settings are configured for the indicator to be run on the 1H chart. As a result, we need to set the "Bars on Lower Timeframe" input to 12. This is because there are 12 x 5-minute bars in 60 minutes.

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟


Very, very clever. One use of this could be to check for a dissonance between the candle close and the dominant type of volume. That's probably as close as we'll get to order flow analysis with TradingView at this current time.

But dude, I love you work and I'd love to see more elements and fixes from. Thank you and keep it up.
+11 رد
in case of any error please

change to lower_buy_vol = nz(security(tickerid, lower_tf, buying_volume(bars_in_tf)))
+5 رد
Very nice one
+2 رد
i would like to use your indicator for stock, but for certain stock, it dont have trade for example 1hour. According to your script, you are calculate the bar of lower timeframe. I had write another script, is it able for us to combine it to perform a better indicator?
This is awesome!
Pretty clever.. Will try it out! Thank you!
ESSCRS Dope_and_Daytrading
@Dope_and_Daytrading, trading view doesnt have tick data there is no way of knowing this info its purely a guess, its a good code and idea but TV doesnt provide the proper info
+5 رد
I had the same thought once I opened and read this publication. It seems just like a poor imitation of real delta volume calculation tools.
BacktestRookies Femistokloff

This indicator was aimed at those without access to the proper volume profile tools TV provides and those interested in learning how to code in pine script (via the code tutorial on the site).

It quite clearly states "This indicator will not give you genuine buying or selling volume "

Read the description and you will see how it is calculated.
+4 رد