# What was the high of the highest volume day?

##### New member
Hi guys! I need to find the date and high of day price for the day with the highest vol in a year--the same for a date X days from today

#I want to find the number of days were volume was >= X. I want to know the date of 2 specific days. 1) The day with the highest vol. 2) The date where the criteria was #met closest to current date. I Need to know the HOD of those 2 days. Below is the code I managed to write with a few days reading about thinkScript.
#I wasn't able to figure out the rest.

input volCriteria = 1;
def vol = volume (period = "DAY");

# Here is where I count the number of days that met the criteria
def conditionMet = if (vol >= volCriteria)then 1 else 0;
def counter = if conditionMet == 1 then counter[1] + 1 else counter [1];

addLabel(yes," 1 Year Highest vol: "+ HighestAll(vol));

Last edited by a moderator:
Hi guys! I need to find the date and high of day price for the day with the highest vol in a year--the same for a date X days from today

#I want to find the number of days were volume was >= X. I want to know the date of 2 specific days. 1) The day with the highest vol. 2) The date where the criteria was #met closest to current date. I Need to know the HOD of those 2 days. Below is the code I managed to write with a few days reading about thinkScript.
#I wasn't able to figure out the rest.

input volCriteria = 1;
def vol = volume (period = "DAY");

# Here is where I count the number of days that met the criteria
def conditionMet = if (vol >= volCriteria)then 1 else 0;
def counter = if conditionMet == 1 then counter[1] + 1 else counter [1];

addLabel(yes," 1 Year Highest vol: "+ HighestAll(vol));

here is something to experiment with.
it finds the highest day volume, within x days. set to 20 for testing.
finds the high of that day.

Code:
``````#vol_hi_day

#What was the high of the highest volume day?

# date and high of day ,
#.. day with the highest vol in a year
#.. a date X days from today

def dat = getyyyymmdd();
#def days = 252;
def days = 20;

def agg = aggregationperiod.day;
def vol = volume(period = agg);
def hi = high(period = agg);
def daycnt = if hi != hi[1] then daycnt[1] + 1 else daycnt[1];
def hivol = highest(vol, days);
def hivoloff = GetMaxValueOffset(vol, days);
def hivolhi = getvalue(hi, hivoloff);

addlabel(1, "highest vol " + hivol, color.yellow);
addlabel(1, "days to highest vol " + hivoloff, color.yellow);
addlabel(1, "high of highest vol " + hivolhi, color.yellow);

#---------------------------------
# test stuff

input test1 = no;
#vol + "\n" +
hivol + "\n" +
hivoloff + "\n" +
hivolhi
, color.yellow, no);
#``````

87k+ Posts
445 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?