RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim

@Princedev What is happening to your VWAP? What time frames have you tried? Place VWAP into the search box above. Hopefully you'll find an different version to try. if a different version doesn't help, that would tell me that you may want to contact ToS Support.
 
Here is my code. Don't rely on it during pre-market hours. Also TOS displays an error when you try to put any volume average period larger than 50 days. This must be because TOS caps how much calculation each column may perform.
Code:
# rvol watchlist column
# by @huskytrader
# 10-31-2019

def volumeAvgPeriodDays = 50;
def volumeAvg = (fold index=1 to volumeAvgPeriodDays+1 with acc=1 do acc+volume(period="DAY")[index]) / volumeAvgPeriodDays;

def volumeToday = volume(period="DAY");

plot a = Round((volumeToday / volumeAvg), 2);
 
Ok then, if sizzle is just puts vs calls...has anyone seen a good TOS script for relative-volume for the first hour of the day? I mean...comparing the first hour with the last twenty FIRST HOUR OF THE DAY. The first hour is almost always above average, so that doesn't count. It must be compared to previous "first hours". Not the last 20 hours of trading. The script must be here somewhere.
 
I like that Adam Grimes chimed in. I like that guy, A LOT!
@DeusMecanicus Thank you. That was helpful!
Hi can you help me with this script, trying to have different colors for the stages of RVOL, anything helps, thanks.
# START
plot c = Volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), 20);
c.SetDefaultColor(Color.BLACK);
AssignBackgroundColor(if c > 2 then Color.PINK else Color.RED);
AssignBackgroundColor(if c > 3 then Color.ORANGE else Color.PINK);
AssignBackgroundColor(if c > 5 then Color.GREEN else Color.ORANGE);
AssignBackgroundColor(if c > 7 then Color.DARK_GREEN else Color.GREEN);
# END
 
@JL356 In your study you can only have a single AssignBackgroundColor statement, your conditions must be embedded within that statement. Here is an example, adjust your levels/colors as needed

Code:
# Relative Volume Watchlist
# tomsk
# 1.4.2020

plot c = Volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), 20);
c.SetDefaultColor(Color.BLACK);
AssignBackgroundColor(if c > 7 then Color.Dark_Green
                      else if c > 5 then Color.Green
                      else if c > 3 then Color.Pink
                      else if c > 2 then Color.Red
                      else Color.Gray);
# End Relative Volume Watchlist
 
Last edited:
(round(volume)/100) / (round(average(volume,50))/100)
This shows volume for 50 days period in % (if you put it on day agg)
so 1.0 % is normal everyday volume... 2.0% is 2x
I use it on my watchlists and scans
 
Last edited:
@ezrollin Thanks Ez, i would like to have one decimal only ,instead on 4 or 5(ex. 4.2 instead of 4.2341)

@tomsk Thank You, very much appreciated. That's very nice of you, love this place.

My Final Adjustments with you guys helping, thanks to all. Shows RVOL, different colors based on values.

Code:
def c = Volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), 20);
AssignBackgroundColor(if c > 7 then Color.Dark_Green
                      else if c > 5 then Color.Green
                      else if c > 3 then Color.Orange
                      else if c > 2 then Color.Pink
                      else Color.red);
AddLabel(yes, AsText(c, NumberFormat.TWO_DECIMAL_PLACES) + "X", Color.Black);

Asking for help one more time, any help will be awesome. It works with volume instead of shares, but i want shares (as millions)

plot x = (shares);
AddLabel (yes, + Round(x * .000001, 1) + "M", Color.yellow);

4x15n3E.png
 
Last edited by a moderator:
@JL356 My assumption is that you're using this on your watchlist. Just a finer point for you to be aware of. In your code above I noticed that you are using both a plot statement as well as an AddLabel. In watchlists you will either have a plot statement or an AddLabel, seldom both. Usually folks use the plot statement because they'd like to be able to sort numerically within the watchlist. With AddLabel you will not be able to sort numerically. Just something for you to be aware of.
 
@JL356 My assumption is that you're using this on your watchlist. Just a finer point for you to be aware of. In your code above I noticed that you are using both a plot statement as well as an AddLabel. In watchlists you will either have a plot statement or an AddLabel, seldom both. Usually folks use the plot statement because they'd like to be able to sort numerically within the watchlist. With AddLabel you will not be able to sort numerically. Just something for you to be aware of.
Thanks Tom, is there a way to do both?
 
Look at it this way - there is already very limited real estate for displays on the watchlists, so keep things simple and dispau things that are important to you. If you do decide that AddLabel is the way to go, then convert your plot statement to a def. Probably best thing to do is to experiment with this. On my watchlists, I only use plots, as it is more important for me to numerically sort/stack numbers. Best of luck out there
 
Look at it this way - there is already very limited real estate for displays on the watchlists, so keep things simple and dispau things that are important to you. If you do decide that AddLabel is the way to go, then convert your plot statement to a def. Probably best thing to do is to experiment with this. On my watchlists, I only use plots, as it is more important for me to numerically sort/stack numbers. Best of luck out there
Thanks again my friend.
 
First time posting here.
I've recently been studying the Relative Volume Standard Deviation Study for ToS for identifying supply and demand pools for support and resistance.

I've been searching for a script to plot a line on the close of the price candle where the indicator spikes above 2. If anyone could help me it would be greatly appreciated.

Here is the Td Ameritrade Script:
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2014-2019
#

declare lower;
declare zerobase;

input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;

def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;

RelVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RelVol.SetLineWeight(3);
RelVol.DefineColor("Above", GetColor(0));
RelVol.DefineColor("Below", GetColor(2));
RelVol.AssignValueColor(if RelVol >= numDev then RelVol.Color("Above") else RelVol.Color("Below"));
StDevLevel.SetDefaultColor(GetColor(7));
StDevLevel.SetStyle(Curve.SHORT_DASH);
Thanks in advance!

Jim
 
@Jim C Per your request, here is a study that plots a horizontal line from the candle where the Relative Volume StDev indicator spikes above 2.0. Note that this is an upper study. In order to verify the results for yourself, also load the standard TOS Relative Volume StDev that displays on a lower chart. You'll see that the signals match up nicely.

Code:
# Relative Volume StDev Horizontal Line
# tomsk
# 1.8.2020

input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;

def bar = barNumber();
def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
def RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
def RelVolBar = if RelVol >= numDev then bar else RelVolBar[1];
def RelVolPrice = if bar == HighestAll(RelVolBar) then close else RelVolPrice[1];

plot HLine = if bar >= HighestAll(RelVolBar) then RelVolPrice else Double.NaN;
HLine.SetDefaultColor(Color.Cyan);
HLine.SetLineWeight(3);
# End Relative Volume StDev Horizontal Line
 
Thank you @tomsk for the quick response and the help!!

Is there a way to plot a line for every bar that is greater than the numDev?
 
Last edited by a moderator:
I have designed it to only plot a horizontal line at the most recent instance of the spike above 2.0 standard deviation. Note that this uses a single variable. Now if you'd like to plot the last 20 occurrences, you'll have to use 20 different variables to maintain it which can get rather cumbersome to manage. On top of that the screen would look very cluttered. I've given you the method so all you need is to replicate that. Personally though I prefer a cleaner approach of just the last instance of that spike
 
I have designed it to only plot a horizontal line at the most recent instance of the spike above 2.0 standard deviation. Note that this uses a single variable. Now if you'd like to plot the last 20 occurrences, you'll have to use 20 different variables to maintain it which can get rather cumbersome to manage. On top of that the screen would look very cluttered. I've given you the method so all you need is to replicate that. Personally though I prefer a cleaner approach of just the last instance of that spike

Ok cool. I’m not great at writing these scripts but I can bird dog my way through them with some direction. If I wanted to create say 3 more variables what would that look like?
 
@Jim C Per your request, I have updated the code and added a couple more variables so that it now plots the last 3 instances of spikes above 2.0 standard deviation. To differentiate them I have colored the plots differently.

CYAN = Most recent
YELLOW = 2nd most recent
WHITE = 3rd most recent

You can add more variables if you like, but pretty soon it will clutter your screen. But if that's what you really want, here's version 1.1 of the Relative Volume StDev Horizontal Line study. I have tested this and this is good to out of the box

Code:
# Relative Volume StDev Horizontal Line
# tomsk
# 1.10.2020

# V1.0 - 01.08.2020 - tomsk - Initial release of Relative Volume StDev Horizontal Line
# V1.1 - 01.10.2020 - tomsk - Added 2nd and 3rd most recent instances of spike above 2.0 St Dev.

input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;

def bar = barNumber();
def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
def RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
def RelVolBar1 = HighestAll(if RelVol >= numDev then bar else 0);
def RelVolBar2 = HighestAll(if RelVol >= numDev and bar < RelVolBar1 then bar else 0);
def RelVolBar3 = HighestAll(if RelVol >= numDev and bar < RelVolBar2 then bar else 0);
def RelVolPrice1 = if bar == RelVolBar1 then close else RelVolPrice1[1];
def RelVolPrice2 = if bar == RelVolBar2 then close else RelVolPrice2[1];
def RelVolPrice3 = if bar == RelVolBar3 then close else RelVolPrice3[1];

plot HLine1 = if bar >= RelVolBar1 then RelVolPrice1 else Double.NaN;
HLine1.SetDefaultColor(Color.Cyan);
HLine1.SetLineWeight(3);
plot HLine2 = if bar >= RelVolBar2 then RelVolPrice2 else Double.NaN;
HLine2.SetDefaultColor(Color.Yellow);
HLine2.SetLineWeight(3);
plot HLine3 = if bar >= RelVolBar3 then RelVolPrice3 else Double.NaN;
HLine3.SetDefaultColor(Color.White);
HLine3.SetLineWeight(3);
# End Relative Volume StDev Horizontal Line
 
@Jim C Per your request, I have updated the code and added a couple more variables so that it now plots the last 3 instances of spikes above 2.0 standard deviation. To differentiate them I have colored the plots differently.

CYAN = Most recent
YELLOW = 2nd most recent
WHITE = 3rd most recent

You can add more variables if you like, but pretty soon it will clutter your screen. But if that's what you really want, here's version 1.1 of the Relative Volume StDev Horizontal Line study. I have tested this and this is good to out of the box

Code:
# Relative Volume StDev Horizontal Line
# tomsk
# 1.10.2020

# V1.0 - 01.08.2020 - tomsk - Initial release of Relative Volume StDev Horizontal Line
# V1.1 - 01.10.2020 - tomsk - Added 2nd and 3rd most recent instances of spike above 2.0 St Dev.

input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;

def bar = barNumber();
def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
def RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
def RelVolBar1 = HighestAll(if RelVol >= numDev then bar else 0);
def RelVolBar2 = HighestAll(if RelVol >= numDev and bar < RelVolBar1 then bar else 0);
def RelVolBar3 = HighestAll(if RelVol >= numDev and bar < RelVolBar2 then bar else 0);
def RelVolPrice1 = if bar == RelVolBar1 then close else RelVolPrice1[1];
def RelVolPrice2 = if bar == RelVolBar2 then close else RelVolPrice2[1];
def RelVolPrice3 = if bar == RelVolBar3 then close else RelVolPrice3[1];

plot HLine1 = if bar >= RelVolBar1 then RelVolPrice1 else Double.NaN;
HLine1.SetDefaultColor(Color.Cyan);
HLine1.SetLineWeight(3);
plot HLine2 = if bar >= RelVolBar2 then RelVolPrice2 else Double.NaN;
HLine2.SetDefaultColor(Color.Yellow);
HLine2.SetLineWeight(3);
plot HLine3 = if bar >= RelVolBar3 then RelVolPrice3 else Double.NaN;
HLine3.SetDefaultColor(Color.White);
HLine3.SetLineWeight(3);
# End Relative Volume StDev Horizontal Line

Tom , thank you again. This helps me a lot. I see now you just number the extra variables. Thank you for taking the time to modify this.
 
need help coding a simple chart label that displays RVOL for the current day compared to the last 30 days. Anyone happen to have a script for this or at least something close I can go off of? thanks.
 

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
251 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