How do we calculate Relative Volume and Relative Volume at Time?

Relative Volume consists of Volume divided by Average Volume, where Average Volume is a Simple Moving Average, calculated on the basis of the past 10 periods (not taking into account the current volume bar). 

Relative Volume = volume / average volume.

Here's the script that allows you to plot Relative Volume on your chart:

//@version=5
indicator("RelVol")
AvgVol = ta.sma(volume,10)
plot(volume/AvgVol[1], title="Relative Volume")

It takes the last 10 bars and makes an SMA, and then divides the volume by this SMA to calculate Relative Volume.

Relative Volume is calculated on any available time interval, the list of which you may see in the opened filter editing dialog:


Relative Volume is not calculated during Extended hours, only during regular trading sessions.

 

Relative Volume at Time however - instead of taking the last 10 bars - only takes the average volume of a single bar per day (for the last 10 days), whichever bar corresponds to the current time. Screener calculate Relative Volume at Time only for 5 minutes bars. For example, we're calculating Relative Volume at Time on 5 minutes (5m) time frame 17 Oct `22 at 10:30. It takes the average volume of each 10:30 5 minutes bar for the last 10 days and calculates the relative volume based on that data. Bars (candles) and volumes are shown in the table:

Bars taken for calculating Relative Volume at a timeVolume
03 Oct `22 10:30
854.093K
04 Oct `22 10:30
1.001M
05 Oct `22 10:30
1.321M
06 Oct `22 10:30
623.869K
07 Oct `22 10:30
1.004M
10 Oct `22 10:30
931.324K
11 Oct `22 10:30
1.31M
12 Oct `22 10:30
752.673K
13 Oct `22 10:30
782.339K
14 Oct `22 10:30
1.032M