Cumulative Volume Indicator
After studying Pine Script deeply and using a bit of old fashioned trial and error over the past few months, I finally got it to work!
And now I’m proud to present the Cumulative Volume indicator you’ve been waiting for.
How The Cumulative Volume Indicator Works
This script adds up the cumulative volume throughout any given trading day (the blue & green volume bars) on any given intraday timeframe on any given market.
Then it compares that cumulative volume value to the total volume of the previous day AND the average cumulative volume of the previous X days for whatever time of day the current bar is printing on.
By default it compares today’s cumulative volume to yesterday’s, but you can set the Lookback higher in the settings menu if desired.
It even takes into consideration random gaps in price action (unlike my RVOL By Time indicator) – so as far as I can tell, it’s as accurate as I can possibly make it.
However it does not work on extended hours for stocks so don’t use it if you have pre-market hours enabled. And there is an inbuilt limitation to how many bars a script can reference on TradingView, so on 1-minute timeframes and lower your Lookback period will be limited and may crash the script if you set it too high.
The PURPLE LINE is the total volume of the previous day.
The GRAY COLUMN is the cumulative volume of the previous day.
The COLORED COLUMN is the current cumulative volume for the current bar.
The BLACK LINE is the Previous Cumulative Volume Line which will draw a black line representing the previous day’s cumulative volume only if today’s CV exceeds the average – this is useful for comparing exactly how far today’s cumulative volume exceeds the previous day’s.
The ORANGE NUMBER is the ratio of today’s CV compared to the average (CV ÷ Average CV).
If the current cumulative volume is less than the previous day’s cumulative volume for that time of day, the bar is blue.
If the current cumulative volume is greater than the previous day’s cumulative volume for that time of day, the bar is dark green.
If the current cumulative volume is greater than the previous day’s total volume, the bar is bright green.
This script also comes with alert functionality.
You can set a Cumulative Volume Alert which will trigger an alert if the current bar’s cumulative volume exceeds the average cumulative volume for that time of day.
You can also set a Total Cumulative Volume Alert which will trigger an alert only if the current bar’s cumulative volume exceeds the total volume of the previous day.
And you can set a CV Ratio Alert which will trigger an alert if today’s CV ÷ Average CV >= Specified Ratio.
Apart from that, the script is fairly self-explanatory so I hope you enjoy using it!
The source code is public & open source so feel free to “borrow” any code you like.
Good luck with your trading, and feel free to drop any suggestions or bug reports and I’ll do my best to help out.
Cumulative Volume Source Code
The source code for this particular script is private.
If you’d like to purchase access to all of my source code including detailed video lessons explaining how and why it was written, then you can find more information over at www.pinescriptmastery.com.
And if not that’s fine! No hard feelings. Not everyone is willing to invest in their education and I respect that decision. But feel free to help yourself to my wealth of other open-source scripts.
Last Updated: 11th November, 2020