 # How do I modify this volume indicator?

#### ReyHak

##### 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);
def chg = 100*(price/avg -1);
plot scan;

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

Last edited:

#### Sonny

##### Active member
VIP
Try this code:

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

#### ReyHak

##### 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

#### ReyHak

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

#### ReyHak

##### Member
Maybe you can help me create an scan out of this please?