Average volume above 50 day average volume

keithmj

New member
Getting the 50 day average volume is pretty simple. However, I'm having a bit of a struggle figuring out how to get the average volume that's above the 50 day average volume.

My original thought was to sum up the volume bars that were above the 50 day average. Something like:

big_vol = if volume > avg_vol then volume + big_vol;

Since I can't use the variable within the definition of the variable, that won't work. I'm thinking in terms of a regular programming language and having a hard time doing what I want within the limits of a scripting language. Can anyone lend a hand?
 
I'm a little confused as to what exactly you're trying to accomplish -
  • Is your 50 day average volume simply the 50 volume SMA on the daily aggregation period?
  • Are you then trying to find out what the 'average volume' is for the daily bars which exceed this 50 day average?
 

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

Getting the 50 day average volume is pretty simple. However, I'm having a bit of a struggle figuring out how to get the average volume that's above the 50 day average volume.

My original thought was to sum up the volume bars that were above the 50 day average. Something like:

big_vol = if volume > avg_vol then volume + big_vol;

Since I can't use the variable within the definition of the variable, that won't work. I'm thinking in terms of a regular programming language and having a hard time doing what I want within the limits of a scripting language. Can anyone lend a hand?

See if this helps. You can view the test bubbles to see where the computations originated.

Capture.jpg
Ruby:
plot vavg  = VolumeAvg().VolAvg;
def vabove = if volume > vavg then vabove[1] + volume else vabove[1];
def vcount = if volume > vavg then vcount[1] + 1 else vcount[1];
addlabel(1, "Vol above VolAvg || " + vabove + " ||  # " + vcount + " || Avg Above " + round(vabove/vcount,0), color.white);

input test = yes;
AddChartBubble(test, low * .995, vcount + "\n " + vabove + "\n" + volume, Color.GRAY);
 
Not exactly. Sorry if that was confusing.

I have the 50 day volume average:
plot avg_vol = Average(volume, 50);

From there, I want to get the average volume that is above that 50 day average. So, I need to figure out how many days the volume was above the 50 and count the total sum of volume from each of those days. Then divide that total by the number of days it was over the 50.

I've been playing around with it since I posted and think I'm getting somewhere. I may be on the right track, but not quite there yet.
 
Not exactly. Sorry if that was confusing.

I have the 50 day volume average:
plot avg_vol = Average(volume, 50);

From there, I want to get the average volume that is above that 50 day average. So, I need to figure out how many days the volume was above the 50 and count the total sum of volume from each of those days. Then divide that total by the number of days it was over the 50.

I've been playing around with it since I posted and think I'm getting somewhere. I may be on the right track, but not quite there yet.
That is what the above code and label display is when the volume is above the 50 day average, it is accumulated along with the count of those bars to create the average
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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