RVOL (Relative Volume) Scan Label Watchlist for ThinkorSwim

How is this Rvol version different from Std variation that is stock in TOS platform or how different it calculates the Rvol?

The below code and the ToS standard deviation of volume to average volume ratio
RelativeVolumeStDev()
https://toslc.thinkorswim.com/cente...ators/studies-library/R-S/RelativeVolumeStDev
Both use the volume to average volume ratio (relative volume)

But the below code uses the higher timeframe (daily) average volume (which repaints on interday charts)
to calculate the volume to average volume ratio (relative volume)

Code:
#Relavitve Volume
# Code
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;
def PMV = if IsNaN(vol) then PMV[1] else vol;
def AV = AggregationPeriod.DAY;
def x = Average(Volume(period=AV)[1],50);
def y1 = Round((PMV/x),2);
def L = Lg(y1);
def p = if L>=1 then 0 else if L>=0 then 1 else 2;
def y2 = Round(y1,p);
plot z = y2;
AssignBackgroundColor(if z > 11 then Color.Cyan
          else if z > 6 then Color.Green
          else if z > 4 then Color.LIME
          else if z > 3 then Color.Yellow
          else if z > 2 then Color.Pink
          else if z < 1 then Color.RED else Color.LIGHT_GRAY);
AddLabel(yes, AsText(z, NumberFormat.TWO_DECIMAL_PLACES) + "x", Color.Black);
#end Code
 
Last edited:

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

Here is my MTF script, showing Bar and Day RVOL premarket, market and post market time frame

Code:
#AIJoe - 1/9/2026
# VS: Volume Spike
# Bar RV: White = normal, Gray = very low, Yellow = high ≥2.0 # Day RV: Gray = normal / low, Yellow = unusually high ≥2.0 # | Level | Interpretation | Actionable Note | #| --------- | -------------------------- | ---------------------------------- | #| ≥ 2.0 | Exceptional daily activity | Strong market attention / momentum | #| 1.5 – 2.0 | Above normal daily volume | Noticeable movement | #| 0.5 – 1.5 | Normal daily activity | Typical day | #| ≤ 0.5 | Very quiet day | Low interest, ignore |

 declare lower;

input length = 21;  # number of days for ADV
input highRVThreshold = 2.0;
input lowRVThreshold = 0.5;

# -----------------------------
# Intraday Bar RV
# -----------------------------
def vol = volume;
def barAvg = Average(vol, length);
def rVolBar = if barAvg > 0 then vol / barAvg else 0;
def isHighBar = rVolBar >= highRVThreshold;
def isLowBar  = rVolBar <= lowRVThreshold;

# -----------------------------
# Daily Volume / ADV / RV
# -----------------------------
# Use daily aggregation for ADV
def dailyVol = volume(period = AggregationPeriod.DAY);
def ADV = Average(dailyVol, length);

# Intraday cumulative volume
rec cumVolToday = if GetDay() != GetDay()[1] then vol else cumVolToday[1] + vol;

# Daily RV
def rVolDay = if ADV > 0 then cumVolToday / ADV else 0;
def isHighDay = rVolDay >= highRVThreshold;
def isLowDay  = rVolDay <= lowRVThreshold;

# -----------------------------
# Unusual Volume Spike
# -----------------------------
def volSpike = rVolBar >= highRVThreshold or rVolDay >= highRVThreshold;

# -----------------------------
# Color Bars
# -----------------------------
AssignPriceColor(
    if volSpike then Color.CYAN
    else if isHighBar then Color.YELLOW
    else if isLowBar then Color.GRAY
    else Color.WHITE
);

# -----------------------------
# Labels
# -----------------------------
AddLabel(
    yes,
    "Bar Vol: " + Round(vol / 1000000,2) + "M | Bar RV: " + Round(rVolBar*100,2),
    if isHighBar then Color.YELLOW else if isLowBar then Color.GRAY else Color.WHITE
);

AddLabel(
    yes,
    "Day Vol: " + Round(cumVolToday / 1000000,2) + "M | ADV: " + Round(ADV / 1000000,2) + "M | Day RV: " + Round(rVolDay,2),
    if isHighDay then Color.YELLOW else if isLowDay then Color.GRAY else Color.WHITE
);

# -----------------------------
# Chart Bubble for Spikes
# -----------------------------
AddChartBubble(volSpike and !volSpike[1], high, "VS", Color.CYAN, yes);
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
680 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