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);
addlabel(yes,"volmin: "+htotvoltensec,color.gray);
 
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
 

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

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.
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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