PROTECTED SOURCE SCRIPT

Volume+ (RVOL By Time of Day)

Updated
This script is an enhanced volume indicator.

It calculates relative volume (RVOL) based on the average volume at that time of day (rather than using a moving average).

For example, using this indicator you can see today’s volume during the first 5-minute candle of the market open compared to the previous day’s volume at the market open. Or you can see today’s volume at the market close during the last 15-minute candle compared to the average of the past 20 days of volume at the market close.

Due to the different quantity of candlesticks in a session between Stocks and Forex/Crypto, I separated those markets into separate settings, making this an all-in-one volume indicator that works on all markets.

Settings:

Stocks
If you set the lookback period to 1 on the 5-minute chart and look at the 9:30am candle for a stock, then the current volume bar will show you what today’s volume is compared to yesterday’s 9:30am 5-minute candle.

If you set the lookback period to 15, then the current volume bar will show you what today’s volume is compared to the average of the last 15 days of 9:30am 5-minute candles.

Max Lookback: 64 Sessions

Stocks [<5m]
This setting is for traders who want to use this indicator on a timeframe lower than the 5-minute chart.

Due to limitations in how many historical bars PineScript can reference, referencing 1-minute and 3-minute bars requires a lot more historical data so I separated the two to allow the 5-minute+ timeframes to have a longer lookback period.

Max Lookback: 12 Sessions

Forex/Crypto
When you set the script to Forex/Crypto, it does the same thing for stocks but calculates based on a 24-hour period.

So if you set the lookback period to 1 on the 1-hour chart and look at the 11:00am candle for a currency pair, then the current volume bar will show you what today’s volume is compared to yesterday’s 11:00am 1-hour candle.

If you set the lookback period to 10, then the current volume bar will show you what today’s volume is compared to the average of the last 10 days of 11:00am 1-hour candles.

Max Lookback: 17 Sessions

What Doesn’t It Work On?

Because I had to manually calculate how many volume candles to look back per timeframe to get the previous session’s candle, I had to hard-code the math in this script.

That means that this indicator will only work on 1m, 3m, 5m, 15m, 30m, 45m, 1h, 2h, 3h, 4h, Daily and Weekly timeframes. If you try to use it on any other timeframe it will revert to a regular volume indicator.

Why Is It Useful?

Similar to volume profile by price, this gives you a volume profile by time in a way that the default volume indicator does not.

For example, you can use this to determine when a stock has a particularly strong opening drive, or when a currency pair has a weak fake-out leading up to the London open, or for general confirmation on trading signals with time-specific volume information to work with.

Colors

The purple line and the faint gray bar is the RVOL value.
The blue number is the percentage of the current volume bar relative to RVOL.

There are four different bar color settings:

Heatmap – Changes color to be brighter based on higher RVOL
Price – Changes color based on price action (like the default TradingView volume indicator)
Traffic – Changes color based on RVOL percentages (for fast visual cues)
Trigger – Changes color only when the specified alert conditions are met

Heatmap:
snapshot

Traffic:
snapshot

Trigger:
snapshot

Price:
snapshot

Heatmap:
Turns very bright green at 2.0 RVOL
Turns light green at 1.0 RVOL
Turns normal green at 0.75 RVOL
Turns medium green at 0.5 RVOL
Turns very dark green at 0.25 RVOL
Is gray otherwise.

Price:
Turns red if the price action candle closed bearish.
Turns green if the price action candle closed bullish.

Traffic:
Turns red if RVOL is between 1.0 and 1.5.
Turns orange if RVOL is between 1.5 and 2.0.
Turns dark green if RVOL is between 2.0 and 3.0.
Turns bright green if RVOL is above 3.0.
Is gray otherwise.

Trigger:
Turns teal if any of the given alert conditions in the user settings are met.

Alerts

Alerts are optional. You have to set them like any other indicator, by creating a new alert and selecting this indicator.
If you leave the "Alert At RVOL %" setting at 0, then alerts will only be triggered if the current candle exceeds the 1.0 (100%) RVOL level.

If you change the "Alert At RVOL %" setting then alerts will be triggered if the RVOL percentage (blue number) exceeds your given value. The blue number is a percentage of the average, so if it’s at 0.5, then it’s 50% of the average.

Notes
- This indicator only works with regular time bars. It will not work with range, tick, renko etc.
- This script has lookback limitations due to restrictions on how many historical bars PineScript can reference. The lookback limit varies based on the market type you choose. The more bars required for calculation the lower the lookback limit.
- If you use it on the Daily timeframe the lookback period will count as 1 week. If you use it on the Weekly timeframe the lookback period will count as 1 month. So a Lookback of 3 on the Daily would be 3 weeks of averages, a Lookback of 5 on the Weekly would be 5 months of averages (for that Day of Week or Week number).
- Big thanks to tb12345 for the idea and for helping to field-testing the indicator!

Release Notes
Added support for Futures markets.
Release Notes
Fixed Crypto Daily volume.
Release Notes
- Updated to V4 of Pine Script.
- Temporarily removed functionality for timeframes below the 15M chart due to inaccurate calculations until I can find a solution.
- Fixed Canadian TSX stocks calculating RVOL incorrectly (added TSX Stocks option).
Release Notes
-
- Added 10-minute timeframe support
Release Notes
-
- Massive re-write of code
- Simplified how the script checks previous X days volume
- Removed option to select market (no longer needed)
- Script should now work on any timeframe & market (but performs best on markets that have consistent trading hours like FX, Crypto & Stocks)
- Added warning label for inconsistent bar counts due to holidays or exchange downtime, which can lead to false readings

USE AT YOUR OWN RISK! IT'S NOT POSSIBLE TO 100% ACCURATELY CALCULATE RVOL ON MARKETS THAT HAVE INCONSISTENT TRADING HOURS USING THIS SCRIPT. SO BEWARE AROUND HOLIDAYS OR AFTER EXCHANGE DOWNTIME - RESULTS MAY BE INACCURATE SO LONG AS THAT HOLIDAY OR DOWNTIME PERIOD IS INCLUDED IN YOUR LOOKBACK PERIOD.
Release Notes
-
- Fixed bug with daily timeframe
- PLEASE NOTE: THE SCRIPT WILL NOT WORK ON MARKETS THAT HAVE INCONSISTENT BAR COUNTS BETWEEN SESSIONS (eg: https://i.ibb.co/qDc0jdw/missing-price-data.png)
Release Notes
- Added "Gradient" color scheme
Release Notes
- Converted to Pine v5
Release Notes
- Changed format to volume type (eg. 1000 vol becomes 1K)
Release Notes
- Removed Volume format as it breaks RVOL counter :(
alertsaveragerelativeRelative Volatility Index (RVI)rvolsessionTIMEVolatilityVolume IndicatorVolume

Protected script

This script is published closed-source and you may privately use it freely.

Want to use this script on a chart?


My Resources Hub: theartoftrading.com
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
Also on:

Disclaimer