All Buy / Sell Volume Pressure Indicators & Labels For ThinkOrSwim

Chris's Enhanced Volume For ThinkOrSwim
Buy / Sell Volume Pressure Percentages

View attachment 913
Buyers and Sellers is not information available in the data feeds.
When we look at the movement of price in comparison to volume, it is called Volume Pressure.
The scripts discussed here are representative of the PRICE spread compared to the overall volume spread.

We create a percentage for buying and selling pressure by using the candlestick patterns weighted volume.
Volume Pressure identifies the price movement which when aggregated with volume it is used to define MOMENTUM not actual buyers and sellers.
You can't apply the momentum percentage to the volume number and declare that to be the number of buyers and sellers.
View attachment 11814View attachment 11815
Ruby:
#Chris' Enhanced Volume V.2 /w Uptick/Downtick

declare on_volume;

###############
#DPL CRITERIA #
###############
input Audible_Alert = yes;
def Deviation_Length = 60;
def Deviate = 2;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;
def belowdev = volumestdev <= Deviate;

############
# DPL BARS #
############
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;

##############################
# UPTICK / DOWNTICK CRITERIA #
##############################
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);

##################
# Selling Volume #
##################
plot SV = Selling;
SV.DefineColor("Decrease", Color.rED);
SV.DefineColor("DevDecrease", Color.pink);
SV.AssignValueColor(if devdecrease then SV.Color("DevDecrease") else SV.Color("Decrease"));
SV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SV.HideTitle();
SV.HideBubble();
SV.SetLineWeight(5);

#################
# Buying Volume #
#################
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
plot BV = Buying;
BV.DefineColor("Increase", GlobalColor("LabelGreen"));
BV.DefineColor("DevIncrease", Color.light_GREEN);
BV.AssignValueColor(if devincrease then BV.Color("DevIncrease") else BV.Color("Increase"));
BV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BV.HideTitle();
BV.HideBubble();
BV.SetLineWeight(5);

#################
# Adding Volume Labels #
#################

input Show_Labels = yes;
AddLabel(Show_Labels, "Buy Vol = " + Round(Buying, 0),
if Buying > Selling then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Buy %: " + Round((Buying/(Buying+Selling))*100,2), If (Buying/(Buying+Selling))*100 > 60 then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell Vol = " + Round(Selling, 0),
if Selling > Buying then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell %: " + Round((Selling/(Selling+Buying))*100,2), If (Selling/(Selling+Buying))*100 > 60 then GlobalColor("LabelGreen") else color.RED);

Buy / Sell Volume Pressure w/ volumes and percentages -- Upper Study Labels Only
Ruby:
#Chris' Enhanced Volume V.2 /w Uptick/Downtick LABELS ONLY

declare upper;
###############
#DPL CRITERIA #
###############
def Deviation_Length = 60;
def Deviate = 2;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;
def belowdev = volumestdev <= Deviate;

############
# DPL BARS #
############
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;

##############################
# UPTICK / DOWNTICK CRITERIA #
##############################
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);

##################
# Selling Volume #
##################
def SV = Selling;
def BV = Buying;

#################
# Adding Volume Labels #
#################
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
input Show_Labels = yes;
AddLabel(Show_Labels, "Buy Vol = " + Round(Buying, 0),
if Buying > Selling then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Buy %: " + Round((Buying/(Buying+Selling))*100,2), If (Buying/(Buying+Selling))*100 > 60 then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell Vol = " + Round(Selling, 0),
if Selling > Buying then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell %: " + Round((Selling/(Selling+Buying))*100,2), If (Selling/(Selling+Buying))*100 > 60 then GlobalColor("LabelGreen") else color.RED);
On the lower study, it doesn't show the number of shares traded in the data box. Is there some way to make it show like on other volume indicators?
 

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

On the lower study, it doesn't show the number of shares traded in the data box. Is there some way to make it show like on other volume indicators?

Your question is: Why are the upper and lower study labels different?
No, they are the same.
 
Chris's Enhanced Volume For ThinkOrSwim
Buy / Sell Volume Pressure Percentages

View attachment 913
Buyers and Sellers is not information available in the data feeds.
When we look at the movement of price in comparison to volume, it is called Volume Pressure.
The scripts discussed here are representative of the PRICE spread compared to the overall volume spread.

We create a percentage for buying and selling pressure by using the candlestick patterns weighted volume.
Volume Pressure identifies the price movement which when aggregated with volume it is used to define MOMENTUM not actual buyers and sellers.
You can't apply the momentum percentage to the volume number and declare that to be the number of buyers and sellers.
View attachment 11814View attachment 11815
Ruby:
#Chris' Enhanced Volume V.2 /w Uptick/Downtick

declare on_volume;

###############
#DPL CRITERIA #
###############
input Audible_Alert = yes;
def Deviation_Length = 60;
def Deviate = 2;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;
def belowdev = volumestdev <= Deviate;

############
# DPL BARS #
############
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;

##############################
# UPTICK / DOWNTICK CRITERIA #
##############################
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);

##################
# Selling Volume #
##################
plot SV = Selling;
SV.DefineColor("Decrease", Color.rED);
SV.DefineColor("DevDecrease", Color.pink);
SV.AssignValueColor(if devdecrease then SV.Color("DevDecrease") else SV.Color("Decrease"));
SV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SV.HideTitle();
SV.HideBubble();
SV.SetLineWeight(5);

#################
# Buying Volume #
#################
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
plot BV = Buying;
BV.DefineColor("Increase", GlobalColor("LabelGreen"));
BV.DefineColor("DevIncrease", Color.light_GREEN);
BV.AssignValueColor(if devincrease then BV.Color("DevIncrease") else BV.Color("Increase"));
BV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BV.HideTitle();
BV.HideBubble();
BV.SetLineWeight(5);

#################
# Adding Volume Labels #
#################

input Show_Labels = yes;
AddLabel(Show_Labels, "Buy Vol = " + Round(Buying, 0),
if Buying > Selling then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Buy %: " + Round((Buying/(Buying+Selling))*100,2), If (Buying/(Buying+Selling))*100 > 60 then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell Vol = " + Round(Selling, 0),
if Selling > Buying then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell %: " + Round((Selling/(Selling+Buying))*100,2), If (Selling/(Selling+Buying))*100 > 60 then GlobalColor("LabelGreen") else color.RED);

Buy / Sell Volume Pressure w/ volumes and percentages -- Upper Study Labels Only
Ruby:
#Chris' Enhanced Volume V.2 /w Uptick/Downtick LABELS ONLY

declare upper;
###############
#DPL CRITERIA #
###############
def Deviation_Length = 60;
def Deviate = 2;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;
def belowdev = volumestdev <= Deviate;

############
# DPL BARS #
############
def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;

##############################
# UPTICK / DOWNTICK CRITERIA #
##############################
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);

##################
# Selling Volume #
##################
def SV = Selling;
def BV = Buying;

#################
# Adding Volume Labels #
#################
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
input Show_Labels = yes;
AddLabel(Show_Labels, "Buy Vol = " + Round(Buying, 0),
if Buying > Selling then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Buy %: " + Round((Buying/(Buying+Selling))*100,2), If (Buying/(Buying+Selling))*100 > 60 then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell Vol = " + Round(Selling, 0),
if Selling > Buying then GlobalColor("LabelGreen") else color.red);

AddLabel(Show_Labels, "Sell %: " + Round((Selling/(Selling+Buying))*100,2), If (Selling/(Selling+Buying))*100 > 60 then GlobalColor("LabelGreen") else color.RED);
Is there anyway to put the volume moving average on this? On the Schwab one it has a line going along the bars showing the volume moving average.
 
Is there anyway to put the volume moving average on this? On the Schwab one it has a line going along the bars showing the volume moving average.

Add a Volume Moving Average Line (simple + optional length input)
Ruby:
# Volume Moving Average #

input volMALength = 20;   
def volMA = Average(volume, volMALength);

plot VolumeMA = volMA;
VolumeMA.SetDefaultColor(Color.YELLOW);
VolumeMA.SetLineWeight(2);
VolumeMA.SetPaintingStrategy(PaintingStrategy.LINE);
 
Hello,
I have been using the CustVolumeStudy by 7 of9 for BRT for years. However, the latest issues with TOS adding multiple decimal places to the volume has been making this studies labels all scrunged up. Was wondering if anyone can resolve this in the code and remove all the decimal points so it just shows the whole number?

UPDATE: I have figured this out and now have a great functioning volume indicator again. Here is the updated code in case anyone else is interested.

Screenshot 2026-04-08 064718.png


Code:
# CustVolumeStudy by 7of9 for BRT (Modified for Whole Numbers)

declare lower;



#Inputs

input Show10DayAvg = yes;

input ShowTodayVolume = yes;

input ShowPercentOf10DayAvg = yes;

input UnusualVolumePercent = 200;

input Show10BarAvg = yes;

input ShowCurrentBar = yes;

input ShowPercentOf10BarAvg = yes;

input ShowSellVolumePercent = yes;



def O = open;

def H = high;

def C = close;

def L = low;



# Rounded base volume to 0 decimal places

def V = Round(volume, 0);



# Rounded buying and selling volume calculations

def buying = Round(V * (C - L) / (H - L), 0);

def selling = Round(V * (H - C) / (H - L), 0);



AddVerticalLine(( GetDay() <> GetDay()[1]), "", Color.YELLOW, Curve.SHORT_DASH);



# Selling Volume

Plot SellVol = selling;

SellVol.setPaintingStrategy(PaintingStrategy.Histogram);

SellVol.SetDefaultColor(Color.Red);

SellVol.HideTitle();

SellVol.HideBubble();

SellVol.SetLineWeight(5);



# Total Volume (Updated to use rounded 'V' instead of raw 'volume')

Plot BuyVol = V;

BuyVol.setPaintingStrategy(PaintingStrategy.Histogram);

BuyVol.SetDefaultColor(Color.Dark_Green);

BuyVol.HideTitle();

BuyVol.HideBubble();

BuyVol.SetLineWeight(5);



# Volume Data (Rounded raw inputs)

def volLast10DayAvg = Round((volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10]) / 10, 0);

def today = Round(volume(period = "DAY"), 0);

def percentOf10Day = Round((today / volLast10DayAvg) * 100, 0);

def avg10Bars = Round((volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10]) / 10, 0);

def curVolume = V;

def percentOf10Bar = Round((curVolume / avg10Bars) * 100, 0);



# Prevent potential division by zero if volume is exactly 0

def SellVolPercent = if V == 0 then 0 else Round((selling / V) * 100, 0);



# Labels (Cleaned up redundant rounding since base variables are now rounded)

AddLabel(Show10DayAvg, "Avg 10 Days: " + volLast10DayAvg, Color.LIGHT_GRAY);

AddLabel(ShowTodayVolume, "Today: " + today, (if percentOf10Day >= UnusualVolumePercent then Color.GREEN else if percentOf10Day >= 100 then Color.ORANGE else Color.LIGHT_GRAY));

AddLabel(ShowPercentOf10DayAvg, percentOf10Day + "%", (if percentOf10Day >= UnusualVolumePercent then Color.GREEN else if percentOf10Day >= 100 then Color.ORANGE else Color.WHITE) );

AddLabel(Show10BarAvg, "Avg 10 Bars: " + avg10Bars, Color.LIGHT_GRAY);

AddLabel(ShowCurrentBar, "Cur Bar: " + curVolume, (if percentOf10Bar >= UnusualVolumePercent then Color.GREEN else if percentOf10Bar >= 100 then Color.ORANGE else Color.LIGHT_GRAY));

AddLabel(ShowPercentOf10BarAvg, percentOf10Bar + "%", (if percentOf10Bar >= UnusualVolumePercent then Color.GREEN else if percentOf10Bar >= 100 then Color.ORANGE else Color.WHITE) );

AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 51 then Color.RED else if SellVolPercent < 49 then Color.GREEN else Color.ORANGE));



input length = 50;



# Updated to use rounded 'V' and rounded the average

plot Vol = V;

plot VolAvg = Round(Average(volume, length), 0);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

Vol.SetLineWeight(3);

Vol.DefineColor("Up", Color.UPTICK);

Vol.DefineColor("Down", Color.DOWNTICK);

Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));

VolAvg.SetDefaultColor(GetColor(8));



declare lower;

#Inputs

input Show10DayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOf10DayAvg = yes;
input UnusualVolumePercent = 200;
input Show10BarAvg = yes;
input ShowCurrentBar = yes;
input ShowPercentOf10BarAvg = yes;
input ShowSellVolumePercent = yes;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def buying = V*(C-L)/(H-L);
def selling = V*(H-C)/(H-L);

AddVerticalLine(( GetDay() <> GetDay()[1]), "", Color.YeLLOW, Curve.SHORT_DASH);

# Selling Volume

Plot SellVol = selling;
SellVol.setPaintingStrategy(PaintingStrategy.Histogram);
SellVol.SetDefaultColor(Color.Red);
SellVol.HideTitle();
SellVol.HideBubble();
SellVol.SetLineWeight(5);

# Total Volume

Plot BuyVol = volume;
BuyVol.setPaintingStrategy(PaintingStrategy.Histogram);
BuyVol.SetDefaultColor(Color.Dark_Green);
BuyVol.HideTitle();
BuyVol.HideBubble();
BuyVol.SetLineWeight(5);

#Volume Data

def volLast10DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10]) / 10;
def today = volume(period = "DAY");
def percentOf10Day = Round((today / volLast10DayAvg) * 100, 0);
def avg10Bars = (volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10]) / 10;
def curVolume = volume;
def percentOf10Bar = Round((curVolume / avg10Bars) * 100, 0);
def SellVolPercent = Round((Selling / Volume) * 100, 0);

# Labels

AddLabel(Show10DayAvg, "Avg 10 Days: " + Round(volLast10DayAvg, 0), Color.LIGHT_GRAY);

AddLabel(ShowTodayVolume, "Today: " + today, (if percentOf10Day >= UnusualVolumePercent then Color.GREEN else if percentOf10Day >= 100 then Color.ORANGE else Color.LIGHT_GRAY));

AddLabel(ShowPercentOf10DayAvg, percentOf10Day + "%", (if percentOf10Day >= UnusualVolumePercent then Color.GREEN else if percentOf10Day >= 100 then Color.ORANGE else Color.WHITE) );

AddLabel(Show10BarAvg, "Avg 10 Bars: " + Round(avg10Bars, 0), Color.LIGHT_GRAY);

AddLabel(ShowCurrentBar, "Cur Bar: " + curVolume, (if percentOf10Bar >= UnusualVolumePercent then Color.GREEN else if PercentOf10Bar >= 100 then Color.ORANGE else Color.LIGHT_GRAY));

AddLabel(ShowPercentOf10BarAvg, PercentOf10Bar + "%", (if PercentOf10Bar >= UnusualVolumePercent then Color.GREEN else if PercentOf10Bar >= 100 then Color.ORANGE else Color.WHITE) );

AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 51 then Color.RED else if SellVolPercent < 49 then Color.GREEN else Color.ORANGE));

input length = 50;

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));
 
Last edited by a moderator:
@Mordoor You can remove decimal points be using the Round() function in your AddLabel() calls using the method below... If editing the code yourself is too difficult we can help, but give it a try first... It sounds like you've been using Thinkorswim long enough to become self-sufficient...

Ruby:
 . . . . Round(volLast10DayAvg, 0) . . . .
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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