# how to get corresponding dates

#### dans

##### New member
on a daily plot, I am trying to get the date of the top high volume. I can get the top volume. I am having trouble to get the according dates. Can anyone please help me out? Thanks a lot!

dan

Solution
on a daily plot, I am trying to get the date of the top high volume. I can get the top volume. I am having trouble to get the according dates. Can anyone please help me out? Thanks a lot!

dan

although i agree with svanoy, i am going to post a code.
i just was looking at a code that had all the code pieces needed, so i copied some and rearranged them and came up with this.

Code:
``````# date_of_hi_vol

# day chart
def bn = barnumber();
def v = volume;
def hv2 = if bn == 1 then v else if v > hv2[1] then v else hv2[1];
input barsBack = 1000;
def c = if !IsNaN(close) and IsNaN(close[-1])
then hv2
else c[1];
def vmax = if isNaN(close[-barsBack])
then c[-barsBack]
else Double.NaN;

def vmax_bar = if...``````
@dans Please post how you are identifying 'top high volume'. It is easier to modify existing code than write new code that may not work with what you have.

on a daily plot, I am trying to get the date of the top high volume. I can get the top volume. I am having trouble to get the according dates. Can anyone please help me out? Thanks a lot!

dan

although i agree with svanoy, i am going to post a code.
i just was looking at a code that had all the code pieces needed, so i copied some and rearranged them and came up with this.

Code:
``````# date_of_hi_vol

# day chart
def bn = barnumber();
def v = volume;
def hv2 = if bn == 1 then v else if v > hv2[1] then v else hv2[1];
input barsBack = 1000;
def c = if !IsNaN(close) and IsNaN(close[-1])
then hv2
else c[1];
def vmax = if isNaN(close[-barsBack])
then c[-barsBack]
else Double.NaN;

def vmax_bar = if vmax == v then 1 else 0;
def vdat = if vmax_bar then GetYYYYMMDD() else vdat[1];

# mobius
def data = vdat;
def year = Round(data/10000, 0);
def month = Round((data % 10000) / 100, 0);
def day = (data % 100);

addLabel(1, "date: " + month + "/" + day + "/" + AsPrice(year), color.yellow);
addlabel(1, "highest volume " + vmax, color.yellow);

addverticalline(vmax_bar, "         " + (month + "/" + day + "/" + AsPrice(year)), color.cyan);
#``````

@dans Please post how you are identifying 'top high volume'. It is easier to modify existing code than write new code that may not work with what you have.
Hi Svanoy, Thanks a lot for looking at this. Sorry I did not write anything regarding 'top high volume'. I was thinking it should be easy to just use Highest(volume, length) to do that.

Thanks.

dan

although i agree with svanoy, i am going to post a code.
i just was looking at a code that had all the code pieces needed, so i copied some and rearranged them and came up with this.

Code:
``````# date_of_hi_vol

# day chart
def bn = barnumber();
def v = volume;
def hv2 = if bn == 1 then v else if v > hv2[1] then v else hv2[1];
input barsBack = 1000;
def c = if !IsNaN(close) and IsNaN(close[-1])
then hv2
else c[1];
def vmax = if isNaN(close[-barsBack])
then c[-barsBack]
else Double.NaN;

def vmax_bar = if vmax == v then 1 else 0;
def vdat = if vmax_bar then GetYYYYMMDD() else vdat[1];

# mobius
def data = vdat;
def year = Round(data/10000, 0);
def month = Round((data % 10000) / 100, 0);
def day = (data % 100);

addLabel(1, "date: " + month + "/" + day + "/" + AsPrice(year), color.yellow);
addlabel(1, "highest volume " + vmax, color.yellow);

addverticalline(vmax_bar, "         " + (month + "/" + day + "/" + AsPrice(year)), color.cyan);
#``````
Hi Halcyonguy,

Thank you so much!

Apparently, I underestimated the workload for getting the highest volume too.

Thank you!

dan

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
370 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
• 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?