Custom average volume script help

lucky

New member
VIP
I need some help. I’m trying to find the average volume of the last 4 days. Then look at today volume to be 5 times the average.

Example:

Volume (02-11-20 + 02-12-20 + 02-13-20 + 02-14-20) divide by 4 =Average

Today Volume ( 02-18-20) = 5 times the average.

Volume( 5,000, 6000, 7000, 8000) divide by 4 = 6,500

Today Volume is 32,500

32,500 / 6,500 = 5 times



Here’s my script

def YesterdayVolAvg = Average(volume(period = AggregationPeriod.DAY), 4)[0];

def YesterdayVol = volume(period = AggregationPeriod.DAY)[0];

plot Scan = YesterdayVol > YesterdayVolAvg * 5;

What about this?

def a = volume 1 day ago

def b = volume 2 day ago

def c = volume 3 day ago

def d = volume 4 day ago

def e = ( a+b+c+d) / 4

def f = today volume

plot scan = f > e*5



I appreciate any help. Thank you

Thanks for all the help
 
Last edited:

lucky

New member
VIP
def CurrentVol = volume;
plot scan;
scan = CurrentVol >5* ((sum(CurrentVol [1], CurrentVol [2], CurrentVol [3], CurrentVol [4]))/4);

I'm stuck... Please help
 

lucky

New member
VIP
def CurrentVol = Volume [0];
def a = Volume [1];
def b = Volume [2];
def c = Volume [3];
def d = Volume [4];
def e = a+b;
def f = c+d;
def g = e+f;
def h = g/4;
def j = h*5;

plot Scan = CurrentVol>j;

I think this is correct.

Can I go back 1 day ago and check?

Can I go back 2 day ago and check?

etc
I appreciate any help. Thank you

Thanks for all the help
 

Len20

Member
Here you go. This should work. Just set the scan to daily aggregation

Code:
def FourDaysVolAvg = Average(volume[1], 4);
def TodayVol = volume;
plot Scan = TodayVol > FourDaysVolAvg * 5;
 

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