highest volume labels

shakib3585

Active member
Hello All,

I would like to request a Thinkswim label with the following criteria:

a) The instance showing the highest volume recorded since the IPO
b) The instance showing the highest volume recorded since the last earnings
c) The instance showing the highest volume recorded for the current year

By "instance," I mean the day, week, or month when any or all of the above (a, b, and c) occurred. The label should indicate the day, week, or month of these occurrences, as well as the volume amount, with a downward arrow pointing to the specific day, week, or month.

Additionally, for 15-minute, 4-hour, and 3-minute aggregation periods, I would like a label that shows the instance of the highest volume occurring over a period of 10 days, with a downward arrow pointing to the moment of occurrence.

Thank you.

@SleepyZ would please care to help me on this with your supreme skill base 🙏🙏

Bumping up for a better reach !
 
Last edited by a moderator:
Solution
code updated to add bubble toggle
I modified the code to match with colored volume labels as thinkorswim @XeoNoX . Also, included one single option to on/off labels and bubbles simultaneously
Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com
input show_HVCE_legend= YES;
input show_HVSLE_legend = YES;
input show_ATHV_legend= Yes;
input vol_length=20;
plot vol = volume;
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")...
no need to bump thread, i skipped it since you specifically asked for sleepyz.

but here you go incase sleepyz is busy

REMEMBER that thinkorswim data has to support going years back for some IPOs. Make sure you know the actual date and make sure its visible on the chart. TOS can only draw/plot/label what is visible on the chart/screen.
.


Highest volume recorded for the current year
Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com

plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
AddLabel (yes, "Highest Volume of Year: " + yearhighvol, Color.YELLOW); # yellow


def himonth = if volume==yearhighvol then getmonth() else himonth[1];
def hiday =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday[1];
def hiyear  = if volume==yearhighvol then getyear() else hiyear[1];

AddLabel (yes, "Month: " + himonth, Color.YELLOW); # yellow
AddLabel (yes, "Day " + hiday, Color.YELLOW); # yellow
AddLabel (yes, "Year: " + hiyear, Color.YELLOW); # yellow


AddChartBubble(volume==yearhighvol, volume, "Highest Vol "  , Color.green, yes);


Highest volume recorded since the last earnings
Code:
#HIGHEST VOLUME SINCE EARNINGS
#If looking for highest since EARNINGS make sure you can see the earnings day on your chart.
#Set your agggregation to make sure your chart can see the earnings date, most people would use day
#by XeoNoX via usethinkscript.com
declare lower;
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
AddLabel (yes, "Highest Volume Since Last Earnings: " + Earnings_Highest_Volume, Color.YELLOW); # yellow



def himonth = if volume==Earnings_Highest_Volume then getmonth() else himonth[1];
def hiday =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday[1];
def hiyear  = if volume==Earnings_Highest_Volume then getyear() else hiyear[1];

AddLabel (yes, "Month: " + himonth, Color.YELLOW); # yellow
AddLabel (yes, "Day " + hiday, Color.YELLOW); # yellow
AddLabel (yes, "Year: " + hiyear, Color.YELLOW); # yellow

AddChartBubble(volume==Earnings_Highest_Volume, volume, "Highest Vol "  , Color.green, yes);


Highest volume visible on chart.
Highest Volume since the IPO
ALL TIME HIGHEST VOLUME

Code:
#HIGHEST VOLUME ON THE CHART
#If looking for highest since IPO make sure you know the IPO date and that your chart can see that day
#Set your agggregation to make sure your chart can see the IPO date, most people would use MONTH
#by XeoNoX via usethinkscript.com
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def alltimehi_vol = HighestAll(volume);
AddLabel (yes, "All time High Volume: " + alltimehi_vol, Color.YELLOW); # yellow

def himonth = if volume==alltimehi_vol then getmonth() else himonth[1];
def hiday =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday[1];
def hiyear  = if volume==alltimehi_vol then getyear() else hiyear[1];

AddLabel (yes, "Month: " + himonth, Color.YELLOW); # yellow
AddLabel (yes, "Day " + hiday, Color.YELLOW); # yellow
AddLabel (yes, "Year: " + hiyear, Color.YELLOW); # yellow

AddChartBubble(volume==alltimehi_vol, volume, "Highest Vol "  , Color.green, yes);





1719035361279.png
 
Last edited:

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

no need to bump thread, i skipped it since you specifically asked for sleepyz.

but here you go incase sleepyz is busy

REMEMBER that thinkorswim data has to support going years back for some IPOs. Make sure you know the actual date and make sure its visible on the chart. TOS can only draw/plot/label what is visible on the chart/screen.
.


Highest volume recorded for the current year
Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com

plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
AddLabel (yes, "Highest Volume of Year: " + yearhighvol, Color.YELLOW); # yellow


def himonth = if volume==yearhighvol then getmonth() else himonth[1];
def hiday =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday[1];
def hiyear  = if volume==yearhighvol then getyear() else hiyear[1];

AddLabel (yes, "Month: " + himonth, Color.YELLOW); # yellow
AddLabel (yes, "Day " + hiday, Color.YELLOW); # yellow
AddLabel (yes, "Year: " + hiyear, Color.YELLOW); # yellow


AddChartBubble(volume==yearhighvol, volume, "Highest Vol "  , Color.green, yes);


Highest volume recorded since the last earnings
Code:
#HIGHEST VOLUME SINCE EARNINGS
#If looking for highest since EARNINGS make sure you can see the earnings day on your chart.
#Set your agggregation to make sure your chart can see the earnings date, most people would use day
#by XeoNoX via usethinkscript.com
declare lower;
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
AddLabel (yes, "Highest Volume Since Last Earnings: " + Earnings_Highest_Volume, Color.YELLOW); # yellow



def himonth = if volume==Earnings_Highest_Volume then getmonth() else himonth[1];
def hiday =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday[1];
def hiyear  = if volume==Earnings_Highest_Volume then getyear() else hiyear[1];

AddLabel (yes, "Month: " + himonth, Color.YELLOW); # yellow
AddLabel (yes, "Day " + hiday, Color.YELLOW); # yellow
AddLabel (yes, "Year: " + hiyear, Color.YELLOW); # yellow

AddChartBubble(volume==Earnings_Highest_Volume, volume, "Highest Vol "  , Color.green, yes);


Highest volume visible on chart.
Highest Volume since the IPO
ALL TIME HIGHEST VOLUME

Code:
#HIGHEST VOLUME ON THE CHART
#If looking for highest since IPO make sure you know the IPO date and that your chart can see that day
#Set your agggregation to make sure your chart can see the IPO date, most people would use MONTH
#by XeoNoX via usethinkscript.com
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def alltimehi_vol = HighestAll(volume);
AddLabel (yes, "All time High Volume: " + alltimehi_vol, Color.YELLOW); # yellow

def himonth = if volume==alltimehi_vol then getmonth() else himonth[1];
def hiday =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday[1];
def hiyear  = if volume==alltimehi_vol then getyear() else hiyear[1];

AddLabel (yes, "Month: " + himonth, Color.YELLOW); # yellow
AddLabel (yes, "Day " + hiday, Color.YELLOW); # yellow
AddLabel (yes, "Year: " + hiyear, Color.YELLOW); # yellow

AddChartBubble(volume==alltimehi_vol, volume, "Highest Vol "  , Color.green, yes);





View attachment 22185
Thank you so much, @XeoNoX. It looks awesome. Can you please combine all of them into one script so it can be in one volume chart only? May I suggest the following modifications, For the highest volume since last earnings, you can use the syntax HVSLE; for all-time high volume, you can use ATHV; and for the highest volume of the current year, you can use HVCE. For the days of the respective occurrences, you can use the MM-DD-YYYY format to save space for the labels
 
Thank you so much, @XeoNoX. It looks awesome. Can you please combine all of them into one script so it can be in one volume chart only? May I suggest the following modifications, For the highest volume since last earnings, you can use the syntax HVSLE; for all-time high volume, you can use ATHV; and for the highest volume of the current year, you can use HVCE. For the days of the respective occurrences, you can use the MM-DD-YYYY format to save space for the labels

here you go all in one study:

Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com
input show_HVCE_label= YES;
input show_HVCE_bubble= YES;
input show_HVSLE_label = YES;
input show_HVSLE_bubble = YES;
input show_ATHV_label= Yes;
input show_ATHV_bubble= Yes;
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
def himonth1 = if volume==yearhighvol then getmonth() else himonth1[1];
def hiday1 =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday1[1];
def hiyear1  = if volume==yearhighvol then getyear() else hiyear1[1];
AddLabel (show_HVCE_label, "HVCE: "+ himonth1 + "/" + hiday1 + "/" + asprice(hiyear1) , Color.YELLOW);
AddChartBubble(show_HVCE_bubble== YES and volume==yearhighvol, volume, "HVCE "  , Color.green, yes);
def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
def himonth2 = if volume==Earnings_Highest_Volume then getmonth() else himonth2[1];
def hiday2 =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday2[1];
def hiyear2  = if volume==Earnings_Highest_Volume then getyear() else hiyear2[1];
AddLabel (show_HVSLE_label, "HVSLE: "+ himonth2 + "/" + hiday2 + "/" + asprice(hiyear2) , Color.YELLOW);
AddChartBubble(show_HVSLE_bubble==YES and volume==Earnings_Highest_Volume, volume, "HVSLE"  , Color.green, yes);
def alltimehi_vol = HighestAll(volume);
def himonth3 = if volume==alltimehi_vol then getmonth() else himonth3[1];
def hiday3 =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday3[1];
def hiyear3  = if volume==alltimehi_vol then getyear() else hiyear3[1];
AddLabel (show_ATHV_label, "ATHV: "+ himonth3 + "/" + hiday3 + "/" + asprice(hiyear3) , Color.YELLOW);
AddChartBubble(show_ATHV_bubble== Yes and volume==alltimehi_vol, volume, "ATHV "  , Color.green, yes);

1719064398907.png
 
Last edited:
here you go all in one study:

Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
def himonth1 = if volume==yearhighvol then getmonth() else himonth1[1];
def hiday1 =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday1[1];
def hiyear1  = if volume==yearhighvol then getyear() else hiyear1[1];
AddLabel (yes, "HVCE: "+ himonth1 + "/" + hiday1 + "/" + hiyear1 , Color.YELLOW);
AddChartBubble(volume==yearhighvol, volume, "HVCE "  , Color.green, yes);
def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
def himonth2 = if volume==Earnings_Highest_Volume then getmonth() else himonth2[1];
def hiday2 =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday2[1];
def hiyear2  = if volume==Earnings_Highest_Volume then getyear() else hiyear2[1];
AddLabel (yes, "HVSLE: "+ himonth2 + "/" + hiday2 + "/" + hiyear2 , Color.YELLOW);
AddChartBubble(volume==Earnings_Highest_Volume, volume, "HVSLE"  , Color.green, yes);
def alltimehi_vol = HighestAll(volume);
def himonth3 = if volume==alltimehi_vol then getmonth() else himonth3[1];
def hiday3 =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday3[1];
def hiyear3  = if volume==alltimehi_vol then getyear() else hiyear3[1];
AddLabel (yes, "ATHV: "+ himonth3 + "/" + hiday3 + "/" + hiyear3 , Color.YELLOW);
AddChartBubble(volume==alltimehi_vol, volume, "ATHV "  , Color.green, yes);

View attachment 22196
Power Extreme @XeoNoX !!! Thank you to the power ultimate!!
 
Last edited:
what if the label colors can be made red or green based on the price of the candle? For example, if the close is greater than open, then the corresponding volume is "BUY" and hence the label should be red and vice versa
 
Last edited by a moderator:
can the labels be colored as GREEN or RED depending on if the volume is "BUY" or "Sell"?

The ToS data feeds only provide volume. The data feed does not break volume down into "BUY" or "Sell".

what if the label colors can be made red or green based on the price of the candle? For example, if the close is greater than open, then the corresponding volume is "BUY" and hence the label should be red and vice versa

Your suggestion has not historically provided helpful results.

@Clarkk @shakib3585
Here is a code that is similar to @shakib3585's request that is a common workaround that members use for painting volume.

Read this to understand that this is NOT real "BUY" or "Sell" volume:
https://usethinkscript.com/threads/...ssure-indicators-labels-for-thinkorswim.8466/

Here is what it looks like compared to your original code:
3qKZFEb.png

Ruby:
#Chris' Enhanced Volume V.2 /w Uptick/Downtick

declare lower;

###############
#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>Selling then color.green 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 Buying>Selling then color.green else color.red);

#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com

def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
def himonth1 = if volume==yearhighvol then getmonth() else himonth1[1];
def hiday1 =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday1[1];
def hiyear1  = if volume==yearhighvol then getyear() else hiyear1[1];
AddLabel (yes, "HVCE: "+ himonth1 + "/" + hiday1 + "/" + hiyear1 , If Buying>Selling then color.green else color.red);
AddChartBubble(volume==yearhighvol, volume, "HVCE "  , If Buying>Selling then color.green else color.red, yes);
def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
def himonth2 = if volume==Earnings_Highest_Volume then getmonth() else himonth2[1];
def hiday2 =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday2[1];
def hiyear2  = if volume==Earnings_Highest_Volume then getyear() else hiyear2[1];
AddLabel (yes, "HVSLE: "+ himonth2 + "/" + hiday2 + "/" + hiyear2 , If Buying>Selling then color.green else color.red);
AddChartBubble(volume==Earnings_Highest_Volume, volume, "HVSLE"  , If Buying>Selling then color.green else color.red, yes);
def alltimehi_vol = HighestAll(volume);
def himonth3 = if volume==alltimehi_vol then getmonth() else himonth3[1];
def hiday3 =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday3[1];
def hiyear3  = if volume==alltimehi_vol then getyear() else hiyear3[1];
AddLabel (yes, "ATHV: "+ himonth3 + "/" + hiday3 + "/" + hiyear3 , If Buying>Selling then color.green else color.red);
AddChartBubble(volume==alltimehi_vol, volume, "ATHV "  , If Buying>Selling then color.green else color.red, yes);
 
Last edited:
The ToS data feeds only provide volume. The data feed does not break volume down into "BUY" or "Sell".



Your suggestion has not historically provided helpful results.

@Clarkk @shakib3585
Here is a code that is similar to @shakib3585's request that is a common workaround that members use for painting volume.

Read this to understand that this is NOT real "BUY" or "Sell" volume:
https://usethinkscript.com/threads/...ssure-indicators-labels-for-thinkorswim.8466/

Here is what it looks like compared to your original code:
3qKZFEb.png

Ruby:
#Chris' Enhanced Volume V.2 /w Uptick/Downtick

declare lower;

###############
#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>Selling then color.green 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 Buying>Selling then color.green else color.red);

#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com

def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
def himonth1 = if volume==yearhighvol then getmonth() else himonth1[1];
def hiday1 =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday1[1];
def hiyear1  = if volume==yearhighvol then getyear() else hiyear1[1];
AddLabel (yes, "HVCE: "+ himonth1 + "/" + hiday1 + "/" + hiyear1 , If Buying>Selling then color.green else color.red);
AddChartBubble(volume==yearhighvol, volume, "HVCE "  , If Buying>Selling then color.green else color.red, yes);
def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
def himonth2 = if volume==Earnings_Highest_Volume then getmonth() else himonth2[1];
def hiday2 =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday2[1];
def hiyear2  = if volume==Earnings_Highest_Volume then getyear() else hiyear2[1];
AddLabel (yes, "HVSLE: "+ himonth2 + "/" + hiday2 + "/" + hiyear2 , If Buying>Selling then color.green else color.red);
AddChartBubble(volume==Earnings_Highest_Volume, volume, "HVSLE"  , If Buying>Selling then color.green else color.red, yes);
def alltimehi_vol = HighestAll(volume);
def himonth3 = if volume==alltimehi_vol then getmonth() else himonth3[1];
def hiday3 =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday3[1];
def hiyear3  = if volume==alltimehi_vol then getyear() else hiyear3[1];
AddLabel (yes, "ATHV: "+ himonth3 + "/" + hiday3 + "/" + hiyear3 , If Buying>Selling then color.green else color.red);
AddChartBubble(volume==alltimehi_vol, volume, "ATHV "  , If Buying>Selling then color.green else color.red, yes);
Thanks much @useThinkScript
 
here you go all in one study:

Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com
plot vol = volume;
vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
def himonth1 = if volume==yearhighvol then getmonth() else himonth1[1];
def hiday1 =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday1[1];
def hiyear1  = if volume==yearhighvol then getyear() else hiyear1[1];
AddLabel (yes, "HVCE: "+ himonth1 + "/" + hiday1 + "/" + hiyear1 , Color.YELLOW);
AddChartBubble(volume==yearhighvol, volume, "HVCE "  , Color.green, yes);
def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
def himonth2 = if volume==Earnings_Highest_Volume then getmonth() else himonth2[1];
def hiday2 =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday2[1];
def hiyear2  = if volume==Earnings_Highest_Volume then getyear() else hiyear2[1];
AddLabel (yes, "HVSLE: "+ himonth2 + "/" + hiday2 + "/" + hiyear2 , Color.YELLOW);
AddChartBubble(volume==Earnings_Highest_Volume, volume, "HVSLE"  , Color.green, yes);
def alltimehi_vol = HighestAll(volume);
def himonth3 = if volume==alltimehi_vol then getmonth() else himonth3[1];
def hiday3 =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday3[1];
def hiyear3  = if volume==alltimehi_vol then getyear() else hiyear3[1];
AddLabel (yes, "ATHV: "+ himonth3 + "/" + hiday3 + "/" + hiyear3 , Color.YELLOW);
AddChartBubble(volume==alltimehi_vol, volume, "ATHV "  , Color.green, yes);

View attachment 22196
Hey @XeoNoX, can you please help modify this code so that there is an option to turn on or off the labels and bubbles for ATHV, HVSLE, and HVCE? Thank you a ton!
 
code updated to add bubble toggle
I modified the code to match with colored volume labels as thinkorswim @XeoNoX . Also, included one single option to on/off labels and bubbles simultaneously
Code:
declare lower;
#HIGHEST VOLUME OF THE YEAR, SINCE EARNINGS, ALL TIME
#Set your agggregation to make sure the entire year is visible, most people would use Day
#by XeoNoX via usethinkscript.com
input show_HVCE_legend= YES;
input show_HVSLE_legend = YES;
input show_ATHV_legend= Yes;
input vol_length=20;
plot vol = volume;
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));
def yearhighvol = HighestAll(if GetLastYear() == GetYear() and !IsNaN(close) and !IsNaN(close[-1]) then volume else 0);
def himonth1 = if volume==yearhighvol then getmonth() else himonth1[1];
def hiday1 =   if volume==yearhighvol then getDayOfMonth(getYYYYMMDD()) else hiday1[1];
def hiyear1  = if volume==yearhighvol then getyear() else hiyear1[1];
AddLabel (show_HVCE_legend, "HVCE: "+ himonth1 + "/" + hiday1 + "/" + asprice(hiyear1) , Color.YELLOW);
AddChartBubble(show_HVCE_legend and volume==yearhighvol, volume, "HVCE "  , Color.green, yes);
def Earnings_Highest_Volume = if HasEarnings()[0] then (volume) else if volume > Earnings_Highest_Volume[1] then volume else Earnings_Highest_Volume[1];
def himonth2 = if volume==Earnings_Highest_Volume then getmonth() else himonth2[1];
def hiday2 =   if volume==Earnings_Highest_Volume then getDayOfMonth(getYYYYMMDD()) else hiday2[1];
def hiyear2  = if volume==Earnings_Highest_Volume then getyear() else hiyear2[1];
AddLabel (show_HVSLE_legend, "HVSLE: "+ himonth2 + "/" + hiday2 + "/" + asprice(hiyear2) , Color.YELLOW);
AddChartBubble(show_HVSLE_legend and volume==Earnings_Highest_Volume, volume, "HVSLE"  , Color.green, yes);
def alltimehi_vol = HighestAll(volume);
def himonth3 = if volume==alltimehi_vol then getmonth() else himonth3[1];
def hiday3 =   if volume==alltimehi_vol then getDayOfMonth(getYYYYMMDD()) else hiday3[1];
def hiyear3  = if volume==alltimehi_vol then getyear() else hiyear3[1];
AddLabel (show_ATHV_legend, "ATHV: "+ himonth3 + "/" + hiday3 + "/" + asprice(hiyear3) , Color.YELLOW);
AddChartBubble(show_ATHV_legend and volume==alltimehi_vol, volume, "ATHV "  , Color.green, yes);

plot VolAvg = Average(volume, vol_length);
VolAvg.SetDefaultColor(GetColor(8));
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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