# Volume quantity in the last 10 seconds script label?

#### drive9

##### New member
I code by copy/paste and frankesteining my needs. Can someone help me here, I'm trying to get a label that tells me the amount of volume in the last 10 seconds. This will give me an idea of the intensity of the tape in a very short span for entries/exits. All ideas are welcomed

Code:
``````input VolStatsPeriod = AggregationPeriod.MIN;
def HO = open(period = VolStatsPeriod);
def HH = high(period = VolStatsPeriod);
def HC = close(period = VolStatsPeriod);
def HL = low(period = VolStatsPeriod);
def HV = volume(period = VolStatsPeriod);
def HBuying = HV * (HC - HL) / (HH - HL);
def HSelling = HV * (HH - HC) / (HH - HL);
def  HtotVol = Round(HBuying, 0) + Round(HSelling, 0) ;
def htotvoltensec = round(htotvol - htotvol[.16],0);

Solution
To the best of my knowledge, this can not be done. The current iteration can only be accessed exactly as it appears at any given moment, and prior iterations can only be accessed in their final state. Time related functions only recognize the exact millisecond that an aggregate begins. You might be able to accomplish something at least somewhat similar by using a small count tick chart, but that's really up to you to figure out. No guarantees, that just where I might look next I were you.
I know the volume - volume[1] will give me the volume in the last minute, however, the downfall is a big order can skew it for a whole minute. I still havent figured it out and help is appreciated.
.i.e. xxx.x[Xx.]x.x.x.x.x.x.[XX.x.x.x.x.x.x.x.xx.x.x.x.x..x.x].x.x.x..x.x

To the best of my knowledge, this can not be done. The current iteration can only be accessed exactly as it appears at any given moment, and prior iterations can only be accessed in their final state. Time related functions only recognize the exact millisecond that an aggregate begins. You might be able to accomplish something at least somewhat similar by using a small count tick chart, but that's really up to you to figure out. No guarantees, that just where I might look next I were you.

Volume tick indicator Questions 0
get the volume every 10 seconds? Questions 0
What was the high of the highest volume day? Questions 0
a stock being in a zero volume area scan Questions 0
Volume Spikes? Questions 1

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