Relative Volume (rVol), Better Volume, Average Volume Comparison

This is the best version of relative volume you can find a claim which is based on the logical soundness of its calculation.
I have amalgamated various volume analysis into one synergistic script. I wasn't going to opensource it. But, as one of the lucky few winners of TradingClue 2. I felt obligated to give something back to the community.

Relative volume traditionally compares current volume to prior bar volume or SMA of volume . This has drawbacks. The question of relative volume is "Volume relative to what?" In the traditional scripts you'll find it displays current volume relative to the last number of bars. But, is that the best way to compare volume . On a daily chart , possibly. On a daily chart this can work because your units of time are uniform. Each day represents a full cycle of volume . However, on an intraday chart? Not so much.

Example: If you have a lookback of 9 on an hourly chart in a 24 hour market, you are then comparing the average volume from Midnight - 9 AM to the 9 AM volume . What do you think you'll find? Well at 9:30 when NY exchanges open the volume should be consistently and predictably higher. But though rVol is high relative to the lookback period, its actually just average or maybe even below average compared to prior NY session opens. But prior NY session opens are not included in the lookback and thus ignored.

This problem is the most visibly noticed when looking at the volume on a CME futures chart or some equivalent. In a 24 hour market, such as crypto, there are website's like skew can show you the volume disparity from time of day. This led me to believe that the traditional rVol calculation was insufficient. A better way to calculate it would be to compare the 9:30 am 30m bar today to the last week's worth of 9:30 am 30m bars. Then I could know whether today's volume at 9:30 am today is high or low based on prior 9:30 am bars. This seems to be a superior method on an intraday basis and is clearly superior in markets with irregular volume

This led me to other problems, such as markets that are open for less than 24 hours and holiday hours on traditional market exchanges. How can I know that the script is accurately looking at the correct prior relevant bars. I've created and/or adapted solutions to all those problems and these calculations and code snippets thus have value that extend beyond this rVol script for other pinecoders.

The Script
This rVol script looks back at the bars of the same time period on the viewing timeframe. So, as we said, the last 9:30 bars. Averages those, then divides the: [Current Volume / Average Volume]. The result is a percentage expressed as x.xxx. Thus 1.0 mean current volume is equal to average volume . Below 1.0 is below the average and above 1.0 is above the average.

This information can be viewed on its own. But there are more levels of analysis added to it.
  • Above the bars are signals that correlate to the "Better Volume Indicator" developed by, I believe, the folks at emini-watch and originally adapted to pinescript by LazyBear. The interpretation of these symbols are in a table on the right of the indicator.
  • The volume bars can also be colored. The color is defined by the relationship between the average of the rVol outputs and the current volume . The "Average rVol" so to speak. The color coding is also defined by a legend in the table on the right.

These can be researched by you to determine how to best interpret these signals. I originally got these ideas and solid details on how to use the analysis from a fellow out there, PlanTheTrade.

I hope you find some value in the code and in the information that the indicator presents. And I'd like to thank the TradingView team for producing the most innovative and user friendly charting package on the market.
(p.s. Better Volume is provides better information with a longer lookback value than the default imo)

Credit for certain code sections and ideas is due to:
LazyBear - Better Volume
Grimmolf (From GitHub) - Logic for Loop rVol
R4Rocket - The idea for my rVol 1 calculation
And I can't find the guy who had the idea for the multiples of volume to the average. Tag him if you know him

Final Note: I'd like to leave a couple of clues of my own for fellow seekers of trading infamy.
Indicators: indicators are like anemometers (The things that measure windspeed). People talk bad about them all the time because they're "lagging." Well, you can't tell what the windspeed is unless the wind is blowing. anemometers are lagging indicators of wind. But forecasters still rely on them. You would use an indicator, which I would define as a instrument of measure, to tell you the windspeed of the markets. Conversely, when people talk positively about indicators they say "This one is great and this one is terrible." This is like a farmer saying "Shovels are great, but rakes are horrible." There are certain tools that have certain functions and every good tool has a purpose for a specific job. So the next time someone shares their opinion with you about indicators. Just smile and nod, realizing one day they'll learn... hopefully before they go broke.

How to forecast: Prediction is accomplished by analyzing the behavior of instruments of measure to aggregate data (using your anemometer). The data is then assembled into a predictive model based on the measurements observed (a trading system). That predictive model is tested against reality for it's veracity (backtesting). If the model is predictive, you can optimize your decision making by creating parameter sets around the prediction that are synergistic with the implications of the prediction (risk, stop loss, target, scaling, pyramiding etc).

リリースノート: Minor Adjustments based on analysis of source script written in EasyLanguage. The impact is minimal, but I recommend using the latest version
リリースノート: Update Notes
  • Update to v5.
  • In this edition I completely overhauled Better-er Volume calculations to be consistent with the concepts that the indicator is based on. Most importantly, the update involves how the volume is weighted. The conditions to test for an event have also been simplified.
  • You can now view Total Volume as well instead of relative volume.
  • You can plot the weighted volume to see how the volume is being weighted and used in the Better-er Volume and Volume Ratings calculations
  • Resolved color issue. The purple plotchar() was blended in to the purple column color. Clarified the plotchar() to improve visibility.
  • There's also a fun code snippet in here. A ratings system. It is a pair of arrays. One that collects data points and a copy of that array that sorts data points. Then, using plotchar() determines which rating is merited based on the data point's position in the array. I think it could be useful for everyone. In this case we are looking for a basic fractal of the readout of Weighted Volume. So look 2 bars left and right, determine the pivot, and store the value. When a new "highest pivot" signal comes. Empty the array and add the new high. Its a neat bit of logic.

New Better-er Volume Calculation
Regardless of whether the bar closes green or red, the volume in each candle is to some extent bullish and some extent bearish. The question (in the absence of true tick data) is how to weight a candle's volume.

The original Better Volume indicator is predicated on these same concepts, but in my research was too fancy about it. I wanted to drill down to the very basics of what I was looking for.

Bull volume is quantified as the volume weighted by the percentage of the candle measured: . The volume executed from the low of the bar to the close of the bar represents the volume executed to push the candle off the low. The bar could close bearish, but have a very long wick, implying the bulls pushed it hard off the low and closed high relative to the range. Thus you could have a bullish candle with a bearish close.

Bear volume is quantified as the volume weighted by the percentage of the candle measured: . From the high, down to the close is the distance the bears pushed the price down in the candle. The bar could close bullish, but with a long upper wick. This could imply that sufficient bearish volume was present to push price down.

1. Just because there is a long wick does not mean that there was a push, it could mean that (in the case of a long bottom wick) that the bears pushed it down with little effort and backed down so as not to push price against themselves, meaning the only thing holding price up is the bid liquidity being offered by the market makers and very low timeframe scalping algos, which operate with small volume requirements.
2. The underlying assumption of this method is that both sides are PUSHING against each other. This assumption is that bulls want higher prices bears want lower prices. This is not always true. Sometimes the bulls pull price lower by lowering their bids and bears pull by raising their asks. But without true tick data, you can only assume one or the other.
Maybe at some point a PULL model can be developed under the opposite assumption. For now, the signals coincide more strongly with signals expected from the Better Volume thesis which is: for volume climaxes, range acts as a volume multiplier and for churn volume, range acts as a volume dividend.

Ratings System
I created a ratings system for spikes in bull and bear volume. When a Better-er Volume signal triggers, the array of stored pivots is reset to zero and value of weighted volume for the new signal is stored at index 0 and shows a rating of 1 (highest). Each subsequent found spike of the weighted volume is then rated against the last better-er volume signal value and is tracked 1-5. In instances of many spikes, a spike can be rated 1 but not coincide with a better-er volume signal because the last signal has fallen out of the array (max 5).
Churn bar ratings are at the bottom because they can overlap with Climax Volume Up and Climax Volume Down.

Important to note. This indicator is not designed at all to use all these signals at once. This indicator can be parsed apart in many different ways to create useful signals. Right now I'm working on combining the signals provided with price action signals, wherein, I won't be seeing any of these calculations on the chart as it will be running in an overlaid strategy. Be creative with how you use it.

I'm open to hearing about better-er ways of measuring volume. Lookup "Better Volume emini" and you'll find an article that provides further information on how the better volume concept functions if you're interested

To utilize original Better Volume calculations, use v12 of the indicator.


TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。