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.

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: