# VOLD RATIO

#### IanBB

##### New member
Hi I was looking for help making a histogram as a lower study.

That will calculate the \$VOLD ratio using \$VOLD, \$UVOL, \$DVOL

If \$UVOL > \$DVOL : \$UVOL / \$DVOL and if \$UVOL < \$DVOL : \$DVOL /\$UVOL .

Could someone please lend a hand? I could really use some assistance. Thank you guys

Solution
Code:
``````declare lower;

input up_symbol = "\$UVOL";
input dn_symbol = "\$DVOL";

def upv = close(symbol = up_symbol);
def dnv = close(symbol = dn_symbol);

addLabel(yes, "Current Upvolume: " + upv + "  ", color.blue);
addLabel(yes, "Current DownVolume: " + dnv + "  ", color.dark_orange);

plot ru = if upv > dnv then upv / dnv else double.nan;
plot rd = if upv < dnv then dnv / upv else double.nan;

ru.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
ru.SetDefaultColor(color.blue);

rd.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
rd.SetDefaultColor(color.dark_orange);``````
Code:
``````declare lower;

input up_symbol = "\$UVOL";
input dn_symbol = "\$DVOL";

def upv = close(symbol = up_symbol);
def dnv = close(symbol = dn_symbol);

addLabel(yes, "Current Upvolume: " + upv + "  ", color.blue);
addLabel(yes, "Current DownVolume: " + dnv + "  ", color.dark_orange);

plot ru = if upv > dnv then upv / dnv else double.nan;
plot rd = if upv < dnv then dnv / upv else double.nan;

ru.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
ru.SetDefaultColor(color.blue);

rd.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
rd.SetDefaultColor(color.dark_orange);``````

87k+ Posts
149 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?