Looking for Relative Volume Indicator in ThinkorSwim


New member

Just wondering if anyone knows if TOS has a Relative Volume Indicator...?

I found the similar one, Sizzle Index, but it seems to be applicable to the Options volume and not the Equity volume. ..
Last edited by a moderator:


Staff member
@ankbhard Try this one

Rich (BB code):
## OneNote Archive Name: Relative Volume to past days Average Relative Volume _v02_Mobius
## Suggested Tos Name using JQ naming convention: RelVolumeVsAvgRelVolume_v02_Mobius
## OneNote Section: Volume    
## Archive Date: 02.10.2019    
## Provenance: Posted by Mobius himself in the Lounge on 02.05.2019

## Archive, Usage or Lounge Notes: 
# 09:18 Mobius: david - 

## End OneNote Archive Header
# Relative Volume to past days Average Relative Volume
# Mobius
# Chat Room Request 01.23.2017

input length = 60;

def v = volume(period = AggregationPeriod.Day);
def active = if secondsFromTime(0930) > 0 and
                secondsTillTime(1600) >= 0
             then 1
             else 0;
def Bars = Ceil((RegularTradingEnd(20160104) - RegularTradingStart(20160104))
                / GetAggregationPeriod());
def newDay = GetDay() != GetDay()[1];
def DayVol = if newDay
                  then v
                  else DayVol[1] + v;
def avgVolume = (fold day = 0 to length 
                 with s 
                 do s + GetValue(DayVol, day * Bars, (length - 1) * Bars)) / length;

plot R = DayVol / avgVolume * 100;
     R.AssignValueColor(if R > 100
                                then color.green
                                else color.red);
# End Code
Last edited:


Well-known member
If those don't suit, try this: btw, I can't help with color on this one.
#From StanL Treepad database ~2014
# RCG3: Unusual volume
input price = volume;
input choice = {default increased, decreased};
input percent = 20;
input length = 50;
def avg = average(price, length)[1];
def chg = 100*(price/avg -1);
plot scan;

switch (choice) {
case increased:
scan = chg >= percent;
case decreased:
scan = chg <= -percent;
Last edited by a moderator:


2019 Donor
I tried to copy above code but i don't see anything on the chart. If you can pleas post screenshot. I have other query: Is it possible to show the indicator top of the chart instead of lower. Example volume RSI or Volume or Customize indicator on top instead of lower.
Last edited by a moderator:


Well-known member
Here's the label!


#Paris in TSL on 1/15/18
# Volume Pct Relative # blt
# 10.5.2016
input length = 50;
def RelVol = volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), length);
AddLabel(1, "Todays Volume / Avg Volume " +
if volume(period = AggregationPeriod.DAY)
> Average(volume(period =
AggregationPeriod.DAY), length)
then Color.GREEN
else Color.RED);
#End of Label Code#

Last edited:


Well-known member
@thinky This is a good code learn from. If you were to look up Relative Volume in the Universe of Think script, you would find that Relative Volume uses the Simple Moving Average. Therefore, it compares today's volume versus the average of the last 50 days. I hope that helps. There are several Relative volume indicators and labels here.


Well-known member
Sizzle Index is for options, Stock Sizzle is for stock. Both are built in. I use both in my scans and as a watchlist column. One thing, Stock Sizzle will not work on Android. I hope that helps.

Any one of the above should work intraday. Putting Stock Sizzle (this is customizable) and Sizzle Index in a scan or watchlist seems to work well for me, but I don't day trade, thus could be wrong. Any opinion?


Well-known member
@markos My understanding of the request from @kolij is that he'd like to see a study of the cumulative volume at a certain bar during RTH compared with the average cumulative volume of the same bar collated over the past X trading sessions. I seem to recall that Mobius had actually posted a volume comparison study for the previous day's volume at the relative bar and current time. While not quite the same thing, this is a lot closer to what @kolij wanted but is not cumulative over time. Perhaps that might be a good starting point for him.


Well-known member
@kolij I believe that this is the study that @tomsk was referring to. I would be a good starting point for you to build off of.
Note that there is also a label that will also show up. I hope this helps...

# Comparison of Today's Volume at bar and Volume at time
# Mobius
# V01.11.02.2017
# V02.11.02.2017 Revision to display On Volume and added a histogram to overlay current volume with previous days volume.

declare On_Volume;

def v = volume;
def bar = barNumber();
def xBar = if SecondsTillTime(0930) == 0
                     then bar
                     else xBar[1];

def pxBar = if xBar != xBar[1]
                         then xBar[1]
                         else pxBar[1];

def zxBar = if SecondsFromTime(0930) >= 0 and
                       SecondsTillTime(1600) > 1
                       then 0
                       else if SecondsTillTime(1600) == 0
                        then bar 
                        else zxBar[1];

def pzxBar = if zxBar != zxBar[1]
                        then zxBar[1]
                        else pzxBar[1];

def pxBars = if bar == xBar
                   then pxBar 
                   else if bar >= xBar
                        then pxBars[1] + 1
                        else pxBars[1]; 

def length = bar - (pxBars-1);

def RelVol = if bar >= xBar
                    then getValue(v, length)
                    else 0;

def pVol = if bar == xBar
                    then 0
                    else if bar > xBar
                         then pVol[1] + RelVol
                         else pVol[1];

def tVol = if SecondsTillTime(0930) == 0
                then v
                else if SecondsFromTime(0930) > 0  and SecondsTillTime(1600) >= 0
                then compoundValue(1, tVol[1] + v, v)
                else tVol[1];

plot pVolHisto = if !isNaN(close) then RelVol else double.nan;
     pVolHisto.AssignValueColor(if RelVol > tVol[1]
                                then createColor(20,125,20)
                                else createColor(150,150,150));

addlabel(1, "yesterdays volume at bar = " + RelVol +
          "  yesterdays volume = " + pVol +
          "  todays volume = " + tVol,
          if tVol > pVol
          then color.green
          else color.red);

# End Code Previous Days Volume Comparison V02