• Get $40 off VIP by signing up for a free account! Sign Up

Relative Volume Indicator For 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:
@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:
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:
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:
@Gmrat468, Instead of Label I need Full indicator. Example : I want to see the RSI indicator TOP Middle actual chart Bottom MACD.
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#



  • 4Cc4ljL.png
    9.7 KB · Views: 183
Last edited:
Perfect , Thank Marcos
You are most welcome! :) A little trick for you; Go into the studies beaker, open it up, and drag the study to the top if you want it at the top of the main chart.
Please type in "Universe" in the search box and browse around the Universe of Thinkscript. There is more there than one can memorize.
@markos What's the input length (50) in the label code?

Some firms use Relative Volume as a number below or above 1, I imagine this is 100% to agree with the label indicator output.
@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.
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?
@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.
@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

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
305 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.