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

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

Last edited:
Try this code:

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

@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

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

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

87k+ Posts
424 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?