RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (2024)

diamondhands

New member
  • May 5, 2021
  • #141

Hello, Can someone explain me why some of them are not showing and giving errors ?

RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (2)

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

SIGN UP NOW LEARN MORE

S

Slippage

Well-known member
  • May 5, 2021
  • #142

diamondhands said:

Hello, Can someone explain me why some of them are not showing and giving errors ?

TOS limits the number of values it's willing to calculate in client side watchlist columns. I'm not sure what the limit is but you can expect those messages any time (symbols x computed columns) is above the limit. This only applies to columns computed on the client side, not server side, so all custom columns and some of the built-in columns like VolSizzle.

I haven't confirmed it but I think I've noticed the limit is global. Meaning every watchlist that has symbols loaded and has computed columns plus any in the scan tab if it's open seem to all be counted toward the same limit.

M

marinoman06

New member
  • May 14, 2021
  • #143

Can someone help me with a few quick things. I'm still very new to ThinkScript. You're more than welcome to use my ideas!

1) I dont like that Relative Volume on TOS is in a standard deviation format. Can someone help me design the code for Relative Volume in this format:

Relative Volume= Todays Vol/Avg. Volume

Where Avg. Volume is Average Volume of the last 30 days. If you could make it so I can change the input later that'd be great!
More than 1.00 should indicate there's more eyes on the stock than normal, Implying a possible Rise or Fall soon.

2) A Bid Size to Ask Size ratio to measure Buying Imbalances as the High Volume Price Climbs up:

Bid/Ask Ratio=Bid size/Ask Size

A less than 1.00 should show a Sell off is starting to happen.

3) The opposite of above, an Ask Size to Bid Size ratio to measure Selling Imbalances as price goes down during a high volume sell off to use for Shorting:

Ask/Bid Ratio=Ask Size/Bid Size

More than 1.00 should indicate there's more Selling than Buying.

I know #2 and #3 could be used with only one ratio but I think done separate measures the extremeness of each situation better.
Also if you have any ideas or possible indicators that can be used for Order Flow or LV.II I'd love to hear and discuss!! I have more ideas but I'm still fairly new to the Thinkscript part of TOS. Thank you!!!

halcyonguy

Moderator - Expert

VIP

Lifetime

  • May 15, 2021
  • #144

J

Jeff1228

Member
  • May 24, 2021
  • #145

alokranjan3 said:

Zanger volume (Simplified code):

#Zanger Volume ratio on 15 minutes chart for RTH
plot RVOL = (volume / ((volume + volume[79] + volume[157] + volume[235] + volume[313] + volume[391] + volume[469] + volume[547] + volume[625] + volume[703] + volume[781] + volume[859] + volume[937] + volume[1015] + volume[1093] + volume[1171] + volume[1249] + volume[1327] + volume[1405] + volume[1483]) / 20) * 100);

RVOL.AssignValueColor(if RVOL > 200 then Color.magenta else if 120 < RVOL and RVOL < 200 then Color.RED else if 80 < RVOL and RVOL < 120 then Color.orange else if 60 < RVOL and RVOL < 80 then Color.GRAY else Color.DARK_GRAY);

From my understanding, Zanger Volume Ratio compares intraday volume accumulation, if it's 15 min bar and calculated on the second bar, Zanger volume compares accumulation of 9:30-10:00 and its average, yours compares 9:45-10:00, not the same thing. Correct me if I'm wrong. Thanks

M

minime

New member
  • May 26, 2021
  • #146

Slippage said:

The code here probably has some bugs. In looking at it, this seems wrong to me:
Why is it using an index of 1, getting the previous bar instead of the current, on everything? That doesn't seem right. That seems like it'll get yesterday's last candle. It should probably be:

I'd paste the rest of my code for you but it doesn't have the active time window concept which you need.

To test/debug all of this, it's probably easiest to change to a 30m chart so you only care about one candle and don't have to keep adding candles' volumes together to see what it's capturing. Add a label that displays cumVolume. Then find the candle with matching volume. If it matches the volume of the wrong candle then play with the index.

Hi, Thx for the code it works well for calculating the first 30mins vol for the past 10 days. It matches my manual calculation perfectly.
One thing bothering me though is during the active time window of the trading day, the code is calculating the current live vol instead of keeping the past data, thus defeating the purpose of the code.
How to change the code so it keeps the past data? This is the current code. Thank you.

Code:

input STime = 0930 ; #hint STime: Start of normal trading hoursinput ETime = 1000 ; #hint ETime: End of normal trading hoursinput thold = 1.5 ; #hint told: Threshold for color break#def bpd = 39 ; # 10mins Bars per day during active trading hoursdef bpd = 78 ; # 5mins Bars per day during active trading hours#def bpd = 130 ; # 3mins Bars per day during active trading hours#def bpd = 195 ; # 2mins Bars per day during active trading hours#def bpd = 390 ; # 1mins Bars per day during active trading hoursdef daycnt = 10; # Number of daysdef IsActive = if secondsTillTime(ETime) > 0 and secondsFromTime(STime) >= 0 then 1 else 0;# This is the cumulative volume for the current day between STime and ETimedef cumVolume = if IsActive and !IsActive[1] then volume else if IsActive then cumVolume[1] + volume else cumVolume[1];# This is the average cumulative volume over the same time period from the previous 10 daysdef cumVolumePrev = (cumVolume[(bpd*1)] + cumVolume[(bpd*2)] + cumVolume[(bpd*3)] + cumVolume[(bpd*4)] + cumVolume[(bpd*5)] + cumVolume[(bpd*6)] + cumVolume[(bpd*7)] + cumVolume[(bpd*8)] + cumVolume[(bpd*9)] + cumVolume[(bpd*10)]) / 10;AddLabel(1, + Round(cumVolumePrev/30, 0), Color.YELLOW);

Last edited:

R

RlyNotUrBroker

New member
  • Jul 23, 2021
  • #147

Hello, I'm trying to setup a scan but the RelativeVolumeStdDev is pulling stocks that are not actually meeting the criteria. Below is what I have so far. I'm clearly telling the script that I need the "num dev" to be above 4 but it consistently pulls stocks that are under 4 and I was wondering why. I think I may need to add something to the code but I don't know where to start.

any help would be appreciated!

RelativeVolStdDev ("length" = 50, "num dev" = 40.
"num dev" is greater than 4

MerryDay

Administrative

Staff member

Staff

VIP

Lifetime

  • Jul 23, 2021
  • #148

@RlyNotUrBroker
The scan works fine. The results are all over 4. If I hazarded a guess as to why you are seeing conflicting results, I would say that your parameters in your scan are not the same as the parameters on your chart.
Here is a Shared Link for the scan: http://tos.mx/n1RPEbc Easiest way to load shared links
PS: you can find the code for the watch list here:
https://usethinkscript.com/threads/relativevolumestdev-watchlist.7287/#post-70362

RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (5)


RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (6)

V

vince92615

New member
  • Jul 23, 2021
  • #149

trying to covert 5mins relativeVolumeStDev to the watchlist on TOS

when relative vol >2 watchlist also change color

anyone can help?

Attachments

  • XPFn4R7Icr.png

    14.8 KB· Views: 229

Last edited:

MintDragon

New member

VIP

  • Jul 25, 2021
  • #150

vince92615 said:

thank you for helping
its on TOS under chart studies.

@vince92615 , if you really are wanting to build a watchlist column using ToS internal RelativeVolumeStDev, you'll want to basically programmatically use that study and check for 3 contiguous bars to be > 2. (or however many contiguous bars you would deem a cluster). and of course, to your selected timeframe (ex. 5min chart).

that's clearly beyond the scope of this thread, which is just a watchlist column for relative volume compared to avg of past XX days.

might be best to open a new thread to see if someone is interested in helping you tinker with it. sounds REALLY compute intensive to try and find a support area for entry on a turnaround. Reason for new thread is that a lot of folks look for the simple solution in this thread, suggesting to keep it cleaner for new folks asking questions about the current indicator. your request is quite unique!

I'll check back on the thread in the hopes that I'm mis-understanding what you are trying to accomplish, and might be able to help. RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (9)

@rad14733 if you pop into a chart and tap the question mark on the RelativeVolumeStDev study, it should pop you into the Education Center with details on the study.

  • Jul 26, 2021
  • #151

May be a long shot here...

I use the TOS study RelativeVolumeStDev very regularly to execute my trading plan. I'm wondering if anyone is able to, or can guide me to a type of alert system that would sound anytime a ticker on my watchlist prints a rVol reading of 2+ on the 5 or 10 minute timeframe...

I have rVol in my watchlist and usually have it sorted by highest throughout the day, but have to look at it every 5-10 minutes to see if anything has received a rVol reading of 2+. I'd love just a little ding or something every time something runs over. I don't even know if this is possible, but figured I'd ask here.

Thanks

rad14733

Well-known member

VIP

  • Jul 26, 2021
  • #152

@mdoss2202 You would need to use a Scan set to send Alerts when a new symbol meets your conditions to do what you have described... That is the best way to handle audible message center and/or mobile Alerts...

M

mdoss2202

New member
  • Jul 26, 2021
  • #153

rad14733 said:

@mdoss2202 You would need to use a Scan set to send Alerts when a new symbol meets your conditions to do what you have described... That is the best way to handle audible message center and/or mobile Alerts...

Thanks. I presume I do this through 'Alerts' > 'Study Alert'

Anyone know if it's possible to block out said alert in the first and last 15 min of the day, bc rVol is always higher then and it's not helpful at that point. Similarly, is it possible to set said alert on my entire watchlist as opposed to doing so one at a time for every ticker?

rad14733

Well-known member

VIP

  • Jul 26, 2021
  • #154

mdoss2202 said:

Thanks. I presume I do this through 'Alerts' > 'Study Alert'

Anyone know if it's possible to block out said alert in the first and last 15 min of the day, bc rVol is always higher then and it's not helpful at that point. Similarly, is it possible to set said alert on my entire watchlist as opposed to doing so one at a time for every ticker?

You possibly could but I usually do it via Scan and then add Alerts to the results... I create the Scan and use my Watchlist for the Scan in selection... The only issue is that the Scans lag so Alerts could be 3 - 7 minutes late... Chart Alerts have no lag but they can only make audible alerts that also populate the Message Center... A Study Alert might be more responsive but I haven't used them, personally...

Last edited:

E

elijahcraig18

New member
  • Aug 24, 2021
  • #155

tomsk said:

The study @BenTen posted on this thread used an AssignPriceColor() statement that would be applicable in charts.

Here's a relative volume for the watchlist I have been using. It is color coded so if the watchlist column is colored LIGHT_GREEN that flags a high relative volume day. Otherwise a PINK color on the watchlist column would indicate regular/moderate relative volume day

Code:

# STARTplot c = Volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), 20);c.SetDefaultColor(Color.BLACK);AssignBackgroundColor(if c > 5 then Color.LIGHT_GREEN else Color.PINK);# END

I'm getting a "custom expression subscription limit exceeded" on some stocks. Is there a way to correct this?

MerryDay

Administrative

Staff member

Staff

VIP

Lifetime

  • Aug 24, 2021
  • #156

@elijahcraig18
'custom expression subscription limit exceeded'

WatchLists


There may only be 1,100 - 1,500 Custom Watchlist Fields displayed in the TOS app at one time. It is necessary to either have fewer results populate the watchlists or have less watchlists. There is no work-around for this limitation.

I

iselloptions

New member
  • Sep 1, 2021
  • #157

BenTen said:

Here is the written code from the link @zeek provided:

Short version:

Code:

def rVol = volume / Average(volume, 21)[1];AddLabel(yes, round(rVol,2));#AddLabel(yes, asPercent(rVol));AssignPriceColor(if rVol >= 1 then color.dark_red else if rVol <=.5 then Color.black else color.Gray);

Long version:

Code:

input length = 21;input offset = 1;def ADV = Average(volume, length)[offset];def rVol = volume /ADV;# remove "#" infront of Addlabels to select prefer choiceAddLabel(yes, round(rVol,2));#AddLabel(yes, asPercent(rVol));AssignPriceColor(if rVol >= 1 then color.dark_red else if rVol <=.5 then Color.black else color.Gray);

is there an advantage and disadvantage from using a shorter or longer code since they give same numbers?

rad14733

Well-known member

VIP

  • Sep 1, 2021
  • #158

iselloptions said:

is there an advantage and disadvantage from using a shorter or longer code since they give same numbers?


@iselloptions The performance difference would be marginal for such a short script... The main difference is whether parameters can be changed using the Study Settings Panel or whether the Study code needs to be manually edited...

Last edited by a moderator:

K

kkrac

New member
  • Sep 9, 2021
  • #159

Slippage said:

How rvol is supposed to be calculated is well known to some of us but I guess it's good you got confirmation for others. There's code already in this thread that has the right intent in how to calculate rvol but it's buggy. I posted comments on how to fix it recently. I'll post my code which is specifically for a watchlist column and you guys can modify for other purposes.

Whoever posted the original code had concerns about it dragging down overall TOS performance which is why I made it handle multiple timeframes. The lower the timeframe the more the performance impact. Though, I'm not sure I ever ran it below 5m so I'm not sure if the concern is warranted. The only real benefit of using a low timeframe is that the data is meaningless until the first period closes and a small period will close earlier. After that it matters less on each subsequent period. Though, you also don't want to set this higher than needed because it compares current volume to the average volume at the start of the period. If you set to 1H then at 11:15 it's comparing current volume to the average at 10:30. Better to narrow that window. After I switched to swing trading I changed mine to 10m. Before that I was using 5m.

This data is meaningless in pre-market. Having accurate pre-market rvol on TOS isn't possible because TOS doesn't have data for periods with no volume and it skews trying to look at the same time of day on previous days. Don't use Extended Hours with this code.

RVOL Watchlist Column Don't use Extended Hours with this code.

Ruby:

input greenLevel = 1.5;def period = GetAggregationPeriod();def minutesPerBar = period / 60000;def minutesPerDay = 60 * 6.5; # 6.5 hours of standard trading sessiondef bpd = minutesPerDay / minutesPerBar; # bars per day# This is the cumulative volume for the current daydef day = GetDay();def cumVolume = if day != day[1] then volume else cumVolume[1] + volume;# average of cumulative volume at this time of day for the last 10 trading daysdef avgCumVolume = (cumVolume[(bpd*1)] + cumVolume[(bpd*2)] + cumVolume[(bpd*3)] + cumVolume[(bpd*4)] + cumVolume[(bpd*5)] + cumVolume[(bpd*6)] + cumVolume[(bpd*7)] + cumVolume[(bpd*8)] + cumVolume[(bpd*9)] + cumVolume[(bpd*10)]) / 10;plot RVol = Round(if IsNaN(cumVolume) then 0 else cumVolume / avgCumVolume, 2);RVol.AssignValueColor(if RVol >= 1 and RVol < greenLevel then Color.YELLOW else if RVol >= greenLevel then Color.LIGHT_GREEN else Color.PINK);

Thanks for this great script, very useful.

One question:

Can you or someone else explain what the following line does? (It is a question that has more to do with thinkScript basics, but wasn't able to find a similar example in TOS thinkscript pages to understand it)

# average of cumulative volume at this time of day for the last 10 trading days
def avgCumVolume = (cumVolume[(bpd*1)] + cumVolume[(bpd*2)] + cumVolume[(bpd*3)] + cumVolume[(bpd*4)] + cumVolume[(bpd*5)] + cumVolume[(bpd*6)] + cumVolume[(bpd*7)] + cumVolume[(bpd*8)] + cumVolume[(bpd*9)] + cumVolume[(bpd*10)]) / 10;

I understand -thanks to the comment- what it is supposed to do. But I don't get where is the cumVolume coming from.
Because when the cumVolume was declared a couple of lines above, it was storing the cumulative volume for the current day.
But in this line you can access the previous days' volume? How come? (no pun intended RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (14))

E

Emrys

New member
  • Sep 10, 2021
  • #160

diamondhands said:

Hello, Can someone explain me why some of them are not showing and giving errors ?

RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (15)

You can easily sort this out by eliminating some custom quotes you are using in other watchlists, or limit the number of stocks in this watchlists. I hope that helps!

You must log in or register to reply here.

RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim - useThinkScript Community (2024)
Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 6232

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.