Custom average volume script help

L

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:
L

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
 
L

lucky

New member
VIP
This is how it look in excel

=SUM((HP2*5)/((HP3+HP4+HP5+HP6)/4))
 
L

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
 
L

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

Top