RVOL (Relative Volume) Indicator / Watchlist for ThinkorSwim

V

vikram

New member
VIP
@horserider May I know if you have the code for relative buy volume scan ? I think it's better indicator than total volume.
 
J

jrwlkr

New member
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

# START
plot 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
First, thanks for the code. Works great when I use it on a scan, but I don't see it in the customize area for watchlists, so I can't create a column for it. I'm a newbie for thinkscript, so maybe I'm probably just missing something. How do you add custom studies so that they appear there? Thanks in advance!
 
J

jlondono2002

New member
Hi guys I need your help, I'm trying to get the value of the percentage of the volume of options with respect to the volume of the stock, example if I have the volume of options CCL 05/29 Call 18 = 30K and the volume of the stock at that moment is 15 million, then ((30K * 100) / 15000000) * 100 = 20%, what would be the code that is required to place it in the watchlist to get that porcentage value??, I appreciate your help, thanks
 
technicallydreaming

technicallydreaming

Member
Stupid question, if you are looking at this indicator as soon as the market opens at 9:30am. Is it comparing the average volume at that given time in trading day or the previous days overall ending tally's at 4pm? If the later, then it would not really make sense to base any intraday trades off this?
 
technicallydreaming

technicallydreaming

Member
Just to clarify this code is able to determine the current volume relative to the average of the x number of days at the same time correct? Example if its 10am I will be able to compare the current days volume to the average of the x number of days at the same time 10am right? I'll test it tomorrow to see how it works.

Did you ever find this out?
 
JonR

JonR

New member
It would be much more relevant to have the scanner compare volumes during a given time of the day. I've done this for a Chart study that compares the today's volume from 9:30am to 10:00am - at 5 minute intervals - to the average volume from the same 5 minute intervals for the previous 5 days. Here is the link: OpeningRangeRelativeVolume I haven't tried this for Scanner. It would need to be more flexible to keep the end point moving through the day. I'm not sure how to do that yet. It's also hard coded to create the average by looking back over the previous 5 days. I wish I knew how to make that more flexible.
Code:
input OrBegin  = 0930.0; #hint OrBegin: Beginning for Period of Opening Range Breakout.
input OrEnd    = 1000.0; #hint OrEnd: End of Period of Opening Range Breakout.

  def ORActive2 = if secondsTillTime(OREnd) > 0 and
                     secondsFromTime(ORBegin) >= 0
                  then 1
                  else 0;
# This will only be true on bars found in the current day
  def today = if getDay() == getLastDay() and
                 secondsFromTime(OrBegin) >= 0
              then 1
              else 0;

# This is the cumulative volume for the current day between OrBegin and OrEnd
def cumVolume = if ORActive2 and !ORActive2[1]
    then volume[1]
    else if ORACtive2 then cumVolume[1] + volume[1]
    else cumVolume[1];

# This is the average cumulative volume over the same time period from the previous 5 days
def cumVolumePrev = if ORActive2 and !ORActive2[1]
    then (volume[(78*1)+1] + volume[(78*2)+1] + volume[(78*3)+1] + volume[(78*4)+1] + volume[(78*5)+1] ) / 5
    else if ORACtive2 then cumVolumePrev[1] + (volume[(78*1)+1] + volume[(78*2)+1]  + volume[(78*3)+1] + volume[(78*4)+1] + volume[(78*5)+1] ) / 5
    else cumVolumePrev[1];

def barNumber = if ORActive2 and !OrActive2[1]
    then 1
    else if ORActive2 then barNumber[1] + 1
    else barNumber[1];


plot Data1 = if GetAggregationPeriod() == AggregationPeriod.FIVE_MIN and ( ORActive2 or !today) then cumVolume / Min( barNumber, 6) else double.NaN ;

plot Data2 = if  GetAggregationPeriod() == AggregationPeriod.FIVE_MIN and (ORActive2 or !today) then cumVolumePrev / Min( barNumber, 6) else double.NaN ;

addCloud(Data1,Data2,createColor(66,160,100),createColor(244,83,66));
 
Last edited:
JonR

JonR

New member
Here is a decent attempt at a High Relative Volume scanner for TOS. It basically adjusts the average daily volume for the current time of day. The adjusted average doesn't really attempt to calculate an average based on actual historical volumes from the previous x number of days for a particular stock during a particular time of day. Seems like that would be very processor intensive and slow to use in a scanner. So instead, the factors (.93, .88, .83....17) take into account the typical volume pattern throughout a trading day for stocks in general.

Code:
input threshhold = 1.5;


def hhr = if SecondsFromTime(1530) >= 0 then 1
    else if SecondsFromTime(1500) >= 0 then .93
    else if SecondsFromTime(1430) >= 0 then .88
    else if SecondsFromTime(1400) >= 0 then .83
    else if SecondsFromTime(1330) >= 0 then .78
    else if SecondsFromTime(1300) >= 0 then .73
    else if SecondsFromTime(1230) >= 0 then .68
    else if SecondsFromTime(1200) >= 0 then .62
    else if SecondsFromTime(1130) >= 0 then .56
    else if SecondsFromTime(1100) >= 0 then .49
    else if SecondsFromTime(1030) >= 0 then .41
    else if SecondsFromTime(1000) >= 0 then .31
    else if SecondsFromTime(0930) >= 0 then .17
    else double.Nan;

def adjAvg = Average("data" = volume, "length" = 65) * hhr;

plot Data = volume / adjAvg > threshhold;
 
Last edited:
W

we29125

Member
Using 5 days as the average. Any existing code to be used on the watchlist.

Relative volume = Current cumulative volume for this time of day / Average cumulative volume for this time of day (5days average);
 
technicallydreaming

technicallydreaming

Member
@JonR Amazing , how can put this in a watchlist colum to sort stocks we track daily ?
 
J

jlondono2002

New member
Just a question guys, what code can I use to get option volume, i need it please
 
JonR

JonR

New member
I've been using this as a Custom Quote column for the past week or so and it seems to work pretty well. It returns a Relative Volume using 30 Minute bars. That is why the "bpd" multiplier is 13. I tried with 5 minute bars, but TOS chokes. Too many calculations I suppose. But I don't think the additional granularity would be useful. If you wanted to try 15 MIN bars, you would change the "bpd" multiplier to 26. I haven't tried that. You could extend this out beyond 10 days by adding more expressions like "+ volume[(bpd*n)+1]" where n is the day number. You would also need to change the daycnt variable.

Code:
input STime = 0930 ; #hint STime: Start of normal trading hours
input ETime = 1530 ; #hint ETime: End of normal trading hours
input thold = 1.5 ; #hint told: Threshold for color break
def bpd = 13 ; # Bars per day during active trading hours
def daycnt = 10; # Number of days

def 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 ETime
def cumVolume = if IsActive and !IsActive[1]
    then volume[1]
    else if IsActive then cumVolume[1] + volume[1]
    else cumVolume[1];

# This is the average cumulative volume over the same time period from the previous 10 days
def cumVolumePrev = if IsActive and !IsActive[1]
    then (volume[(bpd*1)+1] + volume[(bpd*2)+1] + volume[(bpd*3)+1] + volume[(bpd*4)+1] + volume[(bpd*5)+1] + volume[(bpd*6)+1] + volume[(bpd*7)+1] + volume[(bpd*8)+1] + volume[(bpd*9)+1] + volume[(bpd*10)+1] ) / daycnt
    else if IsActive then cumVolumePrev[1] + (volume[(bpd*1)+1] + volume[(bpd*2)+1] + volume[(bpd*3)+1] + volume[(bpd*4)+1] + volume[(bpd*5)+1] + volume[(bpd*6)+1] + volume[(bpd*7)+1] + volume[(bpd*8)+1] + volume[(bpd*9)+1] + volume[(bpd*10)+1] ) / daycnt
    else cumVolumePrev[1];

plot RelVol = cumVolume / cumVolumePrev ;

RelVol.assignValueColor(if RelVol > thold then CreateColor(0,128,0) else CreateColor(128,0,0) );
 
W

we29125

Member
@JonR

input ETime = 1530

any reason why you never put 1600 for end time ?
 
J

Johnny Cash

Member
Hi guys,
Does anyone has a label to show volume percentage.
Exmp:
compare today volume to yesterday volume and display percent
Thanks
 
V

Vimal Mittal

Member
@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.

I love you guys. This is the best watchlist for trading based on volume intraday. However, please tell me if i need in multiple time frame like 3 min, 5 min and 15 min how can i use it? Thanks in advance.
 
V

Vimal Mittal

Member
Also, is this relative volume same as was created by Worden called “ VOLUME BUZZ” which is only available on TC2000 platform not on TOS?

@MBF Can u tell me how to use this in watchlist for intraday trading buy signal or sell signal?

@BenTen Only thing after i loaded in my watchlist, I see numbers but not colors in watchlist. Please explain? How to use these numbers as far as volume going up or down for buy or sell signal intaday trading?

@horserider Is this for watchlist or for scan or just an indicator?

@JL356 i am getting error in my watchlist for "plot x" and "shares" . Do i need to replace with anything?

@BeLikeWater is this possible to create code... if volume is (all above colors) on buy side with positive value and sale side (all above colors) in negative value?
 
Last edited by a moderator:
V

Vimal Mittal

Member
@tomsk Can you create bull vs bear with positive vs negative? for example if stock is down it is negative vs if stock is long, positive ?
 
R

rwfarrell

New member
@BenTen another quick question. Can you tell if there is a scan to add to a watchlist for Relative Volume (RVOL)? Thank you.
 
W

we29125

Member
@JonR How should i change if i want to make it a weekly relative volume ?
 

Similar threads

Top