# Finviz Relative Volume

#### bottomphishing

##### New member
Finviz calculates the Relative Volume as follows: Ratio between current volume and 3-month average value, intraday adjusted. (Relative Volume = Current Volume / 3-month Average Volume)

I'm having trouble with this study as I'm not getting the correct number, possibly I'm getting a % vs dollar value or vise versa.

For ticker SKIN finviz is showing 2.09 and my TOS rvol is 1.02
Maybe 60 does not equal 3 months time? Any guidance will be greatly appreciated!

Code:

input length = 60;
input offset = 1;

# remove "#" infront of Addlabels to select prefer choice

AssignPriceColor(if rVol >= 1 then color.dark_red else if rVol <=.5 then Color.black else color.Gray);
e color.WHITE);

This is the custom column code for anyone interest:

# Finviz RVol Watchlist Scanner
# Creator - Bottomphishing
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;
def PMV = if IsNaN(vol) then PMV[1] else vol; def AV = AggregationPeriod.DAY;
def x = Average(Volume(period=AV)[1],60);
def y1 = Round((PMV/x),2); def L = Lg(y1);
def p = if L>=1 then 0 else if L>=0 then 1 else 2; def y2 = Round(y1,p);
plot z = y2; z.assignValueColor(if z>=10 then color.CYAN else if z>=1 then createcolor(255,153,153) else createcolor(0,215,0));

Last edited by a moderator:
Very helpful, thanks! So is this pretty accurate to Finviz throughout the day or only after closing bell?

Also if I could ask for your help, how would I turn this into a scan for >1.5 for example?

Last edited:
How would you add a label for this?

How should the number produced be interpreted? If it's say a 2 does that mean it's daily volume is twice what what the avg volume has been for the last 60 days?

How should the number produced be interpreted? If it's say a 2 does that mean it's daily volume is twice what what the avg volume has been for the last 60 days?

## Relative Volume​

Relative Volume = Current Volume / 3-month Average Volume
But as the OP states
I'm not getting the correct number, possibly I'm getting a % vs dollar value or vise versa.

This is the custom column code for anyone interest:

# Finviz RVol Watchlist Scanner
# Creator - Bottomphishing
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;
def PMV = if IsNaN(vol) then PMV[1] else vol; def AV = AggregationPeriod.DAY;
def x = Average(Volume(period=AV)[1],60);
def y1 = Round((PMV/x),2); def L = Lg(y1);
def p = if L>=1 then 0 else if L>=0 then 1 else 2; def y2 = Round(y1,p);
plot z = y2; z.assignValueColor(if z>=10 then color.CYAN else if z>=1 then createcolor(255,153,153) else createcolor(0,215,0));

This is so useful, thank you!!!

Hi everyone,

Just joined, thanks everyone for the help with some other issues I've had. Edited this post after getting replies from FinViz. Looking to mimic their relative volume. Average volume column is last 63 trading days. However, for relative volume they use the average volume based on the time of day. So if a stock averages 1M in volume from 9:30 to 10:30 over the last 63 trading days then at 10:30 the rel vol is current volume divided by 1M.

Here is what I have so far. I have things set to 5 minute time frame and extended hours turned off up top. I need to find a way to "skip" 78 repeatedly, looking for a way to either have a nested fold loop or somehow incorporate another variable in the original fold.

Running into some other issues with getvalue() where it seems like once I hit 5 days it starts to give NaN for everything. Tried with setting the timeframe to 5 minutes and getvalue (volume, 390) as well as 15 minutes getvalue(volume, 130) and those work, but anything beyond that returns NaN.
def mystart=0930;
def bar = 79 + rounddown((secondsfromtime(mystart)/300),0);

def totalvolume = fold i = 78 to bar with v = 0 do v + getvalue(volume,i);

plot cumvol= totalvolume;

Last edited:

87k+ Posts
219 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?