SMB Capital style RVOL indicator (& finviz & trade ideas)

sawyersweetman

Member
Plus
SOLVED : CODE BELOW

Hey, I have been searching for awhile for a classic RVOL indicator for TOS. None of this craziness with bright lights and a million signals. Im just trying to get the classic RVOL that is used on FINVIZ.com and Trade ideas. I know other people have been looking for it as well. I can tell by the countless requests similar to the searches i have been making on this forum and other sources.
A couple people have suggested that TOS is just not powerful enough to handle the calculation and there is some fundamental issue?

We have all seen the very simple def rVol = volume / Average(volume, 10) but this is useless intraday for the most part.
The RVOL i need and ive seen many others trying to get also is a INTRADAY RVOL based on the average daily volume.

My questions: Can someone please tell me if this is possible or suggest a better way to get this classic Intraday RVOL I would be 1000% appreciative!
i would also be willing to pay for this indicator if someone wants to go that route! I would however want to keep the code public source as i think this is a much needed indicator that from what i have seen does not have a readily available solution.
I just want a simple RVOL ratio and plot it on a chart label as-well as a custom watchlist column for scanning purposes
Cheers

This is the pseudo calculation
RVOL =
( todays Volume done thus since 9:30am )
Divided by
( last 10 days volume done in the same cumulative time as Today thus far)
Update every 5m and rolling on until 4pm
NOTE: RVOL is a rolling calculation, so as time goes on, the reference period needs to move on as well.
these are two examples based on different times
In actuality it will need to update every 5mins as will the reference period. So if its 9:35 it will be comparing the first 5m, at 9:40 it will be 10m, at 9:45 it will be first 15m and if it is 10:30, it will need to compare the first 1H volume to the previous 10 days first 1H etc etc until 4pm.

The rough idea i had to fufill this calculation in thinkscript was as follows
RVOL =
IF it is 9:40am
Todays volume = ( first 10m candle volume since open)

divided by
(the Average of the Last 10 days first 10m candle volume since open) = ( yesterday first 10m volume + 2day ago first 10m volume + 3 day ago first 10m volume + 4 day ago first 10m volume + 5 day ago first 10m volume + 6 day ago first 10m volume + 7 day ago first 10m volume + 8 day ago first 10m volume + 9 day ago first 10m volume + 10 day ago first 10m volume ) Divided by 10

IF it is 9:45am
RVOL =
Todays volume = ( first 15m candle volume since open)
divided by
(the Average of the Last 10 days first 15m candle volume since open) = ( yesterday first 15m volume + 2day ago first 15m volume + 3 day ago first 15m volume + 4 day ago first 15m volume + 5 day ago first 15m volume + 6 day ago first 15m volume + 7 day ago first 15m volume + 8 day ago first 15m volume + 9 day ago first 15m volume + 15 day ago first 15m volume ) Divided by 10

And so on until 4pm recalculating every 5m.

ANSWER Below and a big thank you to @Svanoy
Notes

1. Use on a 5m - 90day chart
2. Remove after hours data on the chart
3. its a difficult calculation for TOS, its gonna slow down the platform so run it on a separate instance if that is an issue
4. i added dynamic chart label <1 Dark red, <2 red, >2 green, >5 dark green.

declare lower;
input Number_Of_Signals_To_Be_Averaged = 60;
input Value_To_Be_Averaged = volume;

def Active = 1;
def bar = BarNumber();
def BarNum = if !IsNaN(close) then bar else BarNum[1];
def VBar = HighestAll(BarNum);

#################
def NumberedBars;
if GetDay() <> GetDay()[1] {
NumberedBars = 0;
} else {
NumberedBars = NumberedBars[1] + 1;
}

def FirstDayStart = CompoundValue(1, if GetDay() <> GetDay()[1] then 1 else FirstDayStart[1], 0);
def TotalSignalCount = if bar == 1 and GetDay() == GetDay()[1] then 0 else if TotalSignalCount[1] == 0 and FirstDayStart then 1 else if NumberedBars == 1 then TotalSignalCount[1] + 1 else TotalSignalCount[1];
################

def DayRunningTotal;
if !FirstDayStart or !Active {
DayRunningTotal = 0;
} else if NumberedBars == 0 {
DayRunningTotal = Value_To_Be_Averaged;
} else if Active {
DayRunningTotal = DayRunningTotal[1] + Value_To_Be_Averaged;
} else {
DayRunningTotal = 0;
}

def SignalRangeTotal = fold r = 1 to VBar with intr = 0 do if GetValue(NumberedBars, r) == NumberedBars then intr + GetValue(DayRunningTotal, r) else intr;
def TotalToBeRemoved = fold t = 1 to VBar with intt = 0 do if GetValue(NumberedBars, t) == NumberedBars and GetValue(TotalSignalCount, t) < TotalSignalCount - Number_Of_Signals_To_Be_Averaged then intt + GetValue(DayRunningTotal, t) else intt;
def RangeAverage = Round((SignalRangeTotal - TotalToBeRemoved) / Number_Of_Signals_To_Be_Averaged, 0);

def RVOL = if !IsNaN(close) and Active and TotalSignalCount > Number_Of_Signals_To_Be_Averaged and DayRunningTotal[1] / RangeAverage[1] > 0 then DayRunningTotal[1] / RangeAverage[1] else Double.NaN;

def zero = 0;


#addlabel(yes,"RVOL : " + RVOL,color.light_RED);

#AddLabel(yes, "RVOL : " + RVOL, ( if RVOL < 2 then Color.LIGHT_RED else if RVOL >= 2 then Color.LIGHT_GREEN else color.white));

AddLabel(
yes,
"RVOL : " + RVOL,
if RVOL < 1 then Color.DARK_RED
else if RVOL < 2 then Color.LIGHT_RED
else if RVOL > 5 then Color.DARK_GREEN
else if RVOL > 2 then Color.LIGHT_GREEN
else Color.WHITE
);
 
Last edited:
Hey, I have been searching for awhile for a classic RVOL indicator for TOS. None of this craziness with bright lights and a million signals. Im just trying to get the classic RVOL that is used on FINVIZ.com and Trade ideas. I know other people have been looking for it as well. I can tell by the countless requests similar to the searches i have been making on this forum and other sources.
A couple people have suggested that TOS is just not powerful enough to handle the calculation and there is some fundamental issue?

We have all seen the very simple def rVol = volume / Average(volume, 10) but this is useless intraday for the most part.
The RVOL i need and ive seen many others trying to get also is a INTRADAY RVOL based on the average daily volume.

My questions: Can someone please tell me if this is possible or suggest a better way to get this classic Intraday RVOL I would be 1000% appreciative!
i would also be willing to pay for this indicator if someone wants to go that route! I would however want to keep the code public source as i think this is a much needed indicator that from what i have seen does not have a readily available solution.
I just want a simple RVOL ratio and plot it on a chart label as-well as a custom watchlist column for scanning purposes
Cheers

This is the pseudo calculation

RVOL =
( todays Volume done thus since 9:30am )
Divided by
( last 10 days volume done in the same cumulative time as Today thus far)
For me, it seems a bit tricky but i dont understand what is and is not possible in thinkscript well enough to say.

The rough idea i had to fufill this calculation in thinkscript was as follows
RVOL =
IF it is 9:40am
Todays volume = ( first 10m candle volume since open)

divided by
(the Average of the Last 10 days first 10m candle volume since open) = ( yesterday first 10m volume + 2day ago first 10m volume + 3 day ago first 10m volume + 4 day ago first 10m volume + 5 day ago first 10m volume + 6 day ago first 10m volume + 7 day ago first 10m volume + 8 day ago first 10m volume + 9 day ago first 10m volume + 10 day ago first 10m volume ) Divided by 10

IF it is 9:45am
RVOL =
Todays volume = ( first 10m candle volume since open)
divided by
(the Average of the Last 10 days first 15m candle volume since open) = ( yesterday first 15m volume + 2day ago first 15m volume + 3 day ago first 15m volume + 4 day ago first 15m volume + 5 day ago first 15m volume + 6 day ago first 15m volume + 7 day ago first 15m volume + 8 day ago first 15m volume + 9 day ago first 15m volume + 15 day ago first 15m volume ) Divided by 10

And so on until 4pm
Is this what you need?




#Classic RVOL
declare lower;

# User-defined inputs
input show_rvol_940 = yes;
input show_rvol_945 = yes;
input show_rvol_later = yes;

# RVOL calculation for 9:40am
def is_940 = GetTime() == RegularTradingStart(GetYYYYMMDD()) + 940;

def today_volume_10m = if is_940 then volume else today_volume_10m[1];
def last_10_days_volume_10m = (
GetValue(volume, 1) +
GetValue(volume, 2) +
GetValue(volume, 3) +
GetValue(volume, 4) +
GetValue(volume, 5) +
GetValue(volume, 6) +
GetValue(volume, 7) +
GetValue(volume, 8) +
GetValue(volume, 9) +
GetValue(volume, 10)
) / 10;

def rvol_940 = if is_940 then today_volume_10m / last_10_days_volume_10m else rvol_940[1];


# RVOL calculation for 9:45am
def is_945 = GetTime() == RegularTradingStart(GetYYYYMMDD()) + 945;

def today_volume_15m = if is_945 then volume else today_volume_15m[1];
def last_10_days_volume_15m = (
GetValue(volume, 1) +
GetValue(volume, 2) +
GetValue(volume, 3) +
GetValue(volume, 4) +
GetValue(volume, 5) +
GetValue(volume, 6) +
GetValue(volume, 7) +
GetValue(volume, 8) +
GetValue(volume, 9) +
GetValue(volume, 15)
) / 10;

def rvol_945 = if is_945 then today_volume_15m / last_10_days_volume_15m else rvol_945[1];

# RVOL calculation for the rest of the day
def is_later = GetTime() > RegularTradingStart(GetYYYYMMDD()) + 945;

def today_volume_later = if is_later then volume else today_volume_later[1];
def last_10_days_volume_later = (
GetValue(volume, 1) +
GetValue(volume, 2) +
GetValue(volume, 3) +
GetValue(volume, 4) +
GetValue(volume, 5) +
GetValue(volume, 6) +
GetValue(volume, 7) +
GetValue(volume, 8) +
GetValue(volume, 9) +
GetValue(volume, 10)
) / 10;

def rvol_later = if is_later then today_volume_later / last_10_days_volume_later else rvol_later[1];


# Plotting the RVOL values on the chart
plot rvol_940_plot = show_rvol_940 && is_940;
rvol_940_plot.SetDefaultColor(GetColor(1));
rvol_940_plot.SetPaintingStrategy(PaintingStrategy.LINE);
rvol_940_plot.SetLineWeight(1);

plot rvol_945_plot = show_rvol_945 && is_945;
rvol_945_plot.SetDefaultColor(GetColor(2));
rvol_945_plot.SetPaintingStrategy(PaintingStrategy.LINE);
rvol_945_plot.SetLineWeight(1);

plot rvol_later_plot = show_rvol_later && is_later;
rvol_later_plot.SetDefaultColor(GetColor(3));
rvol_later_plot.SetPaintingStrategy(PaintingStrategy.LINE);
rvol_later_plot.SetLineWeight(1);
 
I just want a simple RVOL ratio and plot it on a chart label as-well as a custom watchlist column for scanning purposes


To me, the traditional RVOL usually compares the current day's trading volume to the average daily trading volume over each of the past lets say, 10 days. Just like you said.

What you are inquiring about is a much more specific window of time. That said, the script above is exactly what I also thought you need. I’m thinking that should work.
 
@Trader4TOS
Hey, thanks alot for the comment on this. I think you are onto something, i need to plug it in and give it a try but this looks like you may have took my two examples literally. What i meant to say with those examples is that would be just two possibilities for how it would be calculated for the different times of day.
In actuality its a rolling calculation so it would update every 5mins and accumulate as it goes.
So first it looks at the first 5m volume, then 10m volume, then 15, 20, 25, 30 etc etc etc.

Is that "GetValue(volume, 1)" pulling the volume from the previous days?
 
@khpro59 Yeah you're right. The reason is that that traditional very simple Rvol calculation isnt useful for intraday trading because you are comparing a full days trading volume to the current trading volume (which is only a fraction of the full day). you are not really getting any useful information, unless ofcourse its doing massive volume on the day and its already done 1x the ADV in the first few mins of trading. in that case its obvious there is volume, but usually its more subtle then that.

Its ALOT easier to quantify that information. It tells me immediately if that stock is in play based on the same criteria at any point in the day. Its pure gold if you are intraday trading.

A stock that is doing 3+ rvol is in play, no doubt about it, and that can change through out the day. maybe it started off at 1 Rvol and by the some random time, its RVOL pops 10+.
Maybe it started off above 3 and then trended down to 1.5, this would be a bad sign if you are expecting an outsized move. If RVOL is trending higher, ATR can expand
Probably the single most important variable for an intraday trader. If you are trading a stock doing average volume you are playing mostly algorithms, and you aren't going get a clear signal with traditional TA. A higher low or higher high, a trendline break etc might not be as significant as if the stock is truly in play.

I recommend it, i hope we can come to a conclusion with a good RVOL indicator here
 
@Trader4TOS This is what i get with that code.
Also i am only looking for a chart label & watchlist column, like you can see in the top left of this photo, like my ATR and GAP labels.
 

Attachments

  • Screen Shot 2023-07-08 at 6.12.25 PM.png
    Screen Shot 2023-07-08 at 6.12.25 PM.png
    243.6 KB · Views: 274
@khpro59 Yeah you're right. The reason is that that traditional very simple Rvol calculation isnt useful for intraday trading because you are comparing a full days trading volume to the current trading volume (which is only a fraction of the full day). you are not really getting any useful information, unless ofcourse its doing massive volume on the day and its already done 1x the ADV in the first few mins of trading. in that case its obvious there is volume, but usually its more subtle then that.

Its ALOT easier to quantify that information. It tells me immediately if that stock is in play based on the same criteria at any point in the day. Its pure gold if you are intraday trading.

A stock that is doing 3+ rvol is in play, no doubt about it, and that can change through out the day. maybe it started off at 1 Rvol and by the some random time, its RVOL pops 10+.
Maybe it started off above 3 and then trended down to 1.5, this would be a bad sign if you are expecting an outsized move. If RVOL is trending higher, ATR can expand
Probably the single most important variable for an intraday trader. If you are trading a stock doing average volume you are playing mostly algorithms, and you aren't going get a clear signal with traditional TA. A higher low or higher high, a trendline break etc might not be as significant as if the stock is truly in play.

I recommend it, i hope we can come to a conclusion with a good RVOL indicator here
I will look into it.
 
@Trader4TOS Are you interested in helping code it on TOS?


@Trader4TOS
i think you are confused on what the original poster (op) is asking for and the use of getvalue().

he gave a couple examples, that you hard coded (with constants).
he wants it to work with any quantity of days and/or any chart time, not only 10 minutes or 10 days.
he wants to add up the volumes during several partial days and calculate an average.

if the chart is 10 minutes, and the time is 10:00 , your code will not add up the previous 10 days.

def last_10_days_volume_later = (
GetValue(volume, 1) +
GetValue(volume, 2) +
GetValue(volume, 3) +
GetValue(volume, 4) +
...

it will add up volume from the 10 previous bars,
from 9:50 , 9:40, 9:30, then from the previous day, 3:50, 3:40, 3:30,....

your code can not be modified to work as desired.



@sawyersweetman
i think i have something. i will test it during trading hours, then post it.
 
@Trader4TOS
i think you are confused on what the original poster (op) is asking for and the use of getvalue().

he gave a couple examples, that you hard coded (with constants).
he wants it to work with any quantity of days and/or any chart time, not only 10 minutes or 10 days.
he wants to add up the volumes during several partial days and calculate an average.

if the chart is 10 minutes, and the time is 10:00 , your code will not add up the previous 10 days.

def last_10_days_volume_later = (
GetValue(volume, 1) +
GetValue(volume, 2) +
GetValue(volume, 3) +
GetValue(volume, 4) +
...

it will add up volume from the 10 previous bars,
from 9:50 , 9:40, 9:30, then from the previous day, 3:50, 3:40, 3:30,....

your code can not be modified to work as desired.



@sawyersweetman
i think i have something. i will test it during trading hours, then post it.
@halcyonguy Nail on the head, bravo. its a pleasure to have someone on the same page.
Im looking forward to seeing what you have

Yes. When I get a chance I will update the script with the variables you previously mentioned in TOS format.
Awesome thanks for taking the time, i look forward to seeing what you come up with
 
Last edited by a moderator:
Hey, I have been searching for awhile for a classic RVOL indicator for TOS. None of this craziness with bright lights and a million signals. Im just trying to get the classic RVOL that is used on FINVIZ.com and Trade ideas. I know other people have been looking for it as well. I can tell by the countless requests similar to the searches i have been making on this forum and other sources.
A couple people have suggested that TOS is just not powerful enough to handle the calculation and there is some fundamental issue?

We have all seen the very simple def rVol = volume / Average(volume, 10) but this is useless intraday for the most part.
The RVOL i need and ive seen many others trying to get also is a INTRADAY RVOL based on the average daily volume.

My questions: Can someone please tell me if this is possible or suggest a better way to get this classic Intraday RVOL I would be 1000% appreciative!
i would also be willing to pay for this indicator if someone wants to go that route! I would however want to keep the code public source as i think this is a much needed indicator that from what i have seen does not have a readily available solution.
I just want a simple RVOL ratio and plot it on a chart label as-well as a custom watchlist column for scanning purposes
Cheers

This is the pseudo calculation
RVOL =
( todays Volume done thus since 9:30am )
Divided by
( last 10 days volume done in the same cumulative time as Today thus far)
Update every 5m and rolling on until 4pm
NOTE: RVOL is a rolling calculation, so as time goes on, the reference period needs to move on as well.
these are two examples based on different times
In actuality it will need to update every 5mins as will the reference period. So if its 9:35 it will be comparing the first 5m, at 9:40 it will be 10m, at 9:45 it will be first 15m and if it is 10:30, it will need to compare the first 1H volume to the previous 10 days first 1H etc etc until 4pm.

The rough idea i had to fufill this calculation in thinkscript was as follows
RVOL =
IF it is 9:40am
Todays volume = ( first 10m candle volume since open)

divided by
(the Average of the Last 10 days first 10m candle volume since open) = ( yesterday first 10m volume + 2day ago first 10m volume + 3 day ago first 10m volume + 4 day ago first 10m volume + 5 day ago first 10m volume + 6 day ago first 10m volume + 7 day ago first 10m volume + 8 day ago first 10m volume + 9 day ago first 10m volume + 10 day ago first 10m volume ) Divided by 10

IF it is 9:45am
RVOL =
Todays volume = ( first 15m candle volume since open)
divided by
(the Average of the Last 10 days first 15m candle volume since open) = ( yesterday first 15m volume + 2day ago first 15m volume + 3 day ago first 15m volume + 4 day ago first 15m volume + 5 day ago first 15m volume + 6 day ago first 15m volume + 7 day ago first 15m volume + 8 day ago first 15m volume + 9 day ago first 15m volume + 15 day ago first 15m volume ) Divided by 10

And so on until 4pm recalculating every 5m.

edit , i don't know why i said my? i don't see a post from me there?

here is my version
https://usethinkscript.com/threads/intraday-relative-volume-upper-chart-study-rvol.16051/
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
260 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top