How do I modify this volume indicator?

R

ReyHak

New member
Hi, I'm new here! I like to add this indicator to my watch list, this indicator returns 1 if volume is 10% above average volume and returns 0 if below 10% of average volume. How do I modify this to give me the actual % instead of 1 or 0? So if volume is 48% above average volume, it should return 48% instead of 1.

Any help would be greatly appreciated.



Code:
#Wizard text: Current bar's
#Wizard input: price
#Wizard input: choice
#Wizard text: at least
#Wizard input: percent
#Wizard text: % from its typical average over
#Wizard input: length
#Wizard text: periods

input price = volume;
input choice = {default increased, decreased};
input percent = 10;
input length = 50;
def avg = average(price, length)[1];
def chg = 100*(price/avg -1);
plot scan;

switch (choice) {
case increased:
    scan = chg >= percent;
case decreased:
    scan = chg <= -percent;
}
 
Last edited:
S

Sonny

Active member
VIP
Try this code:

def x = Average(volume, 60)[1];
def v = volume;
plot z = Round(100*((v/x)-1),1);
 
R

ReyHak

New member
@Sonny thank you for your reply, the calculation is not exactly right
how do I change it to this?
(Volume - average volume) / average volume
thanks again
 
R

ReyHak

New member
nevermind, I figured it out, thanks again
def x = Average(volume, 50);
def v = volume;
plot z = Round(100*((v-x)/x),1);
 
R

ReyHak

New member
Maybe you can help me create an scan out of this please?
 

Similar threads

Top