# Looking for candle volume summary labels (green candles total vs. red candles total)

#### jumanjiz

##### New member
VIP
Apologies if this has been done before, i couldnt find it.

I am looking for a study that puts a label on my chart. What it does is add up the volume candles that are green on the day so far and display that in a label, then do the same for red and display that, then display a ratio green volume/red volume multiple.. ignores true doji candles (open price = close price)

So on the one minute chart it just gives you (a) the volume sum to the current minute of all the green 1 minute candles, (b) volume sum of all the red 1 minute candles and (c) a/b ...

Does that exist or can anyone create?

Many thanks

I'm not sure if I understand what you mean by volume candles. But if you are simply looking to count green vs red candles, I wrote this little thing that resets the count at 9:30am each day. Might be a good starting point:
Ruby:
input NYOpen = 0930;
def isNYOpen = secondsFromTime(NYOpen) == 0;
def isUp = close > open;
def isDown = close < open;

def bullCount = if isNYOpen then 0 else if isUp then bullCount[1] + 1 else bullCount[1];

def bearCount = if isNYOpen then 0 else if isDown then bearCount[1] + 1 else bearCount[1];

I'm not sure if I understand what you mean by volume candles. But if you are simply looking to count green vs red candles, I wrote this little thing that resets the count at 9:30am each day. Might be a good starting point:
Ruby:
input NYOpen = 0930;
def isNYOpen = secondsFromTime(NYOpen) == 0;
def isUp = close > open;
def isDown = close < open;

def bullCount = if isNYOpen then 0 else if isUp then bullCount[1] + 1 else bullCount[1];

def bearCount = if isNYOpen then 0 else if isDown then bearCount[1] + 1 else bearCount[1];

Thanks man!! This is great as a step one.

As a step 2, can you add the total volume in each category, so if it was like

84 green and 105 red, ratio 0.8

it would say

84 - 5,432,167 105 - 6,136,789 Ratio 0.8, 0.85 (or whatever the math is...)

Where the second numbers is the sum of the volume in each category?

So # green candles - volume in those candles, # red candles - volume in those candles, Ratio - g/r candles, g-volume/r-volume

Gracias!

Last edited:
Thanks man!! This is great as a step one.

As a step 2, can you add the total volume in each category, so if it was like

84 green and 105 red, ratio 0.8

it would say

84 - 5,432,167 105 - 6,136,789 Ratio 0.8, 0.85 (or whatever the math is...)

Where the second numbers is the sum of the volume in each category?

So # green candles - volume in those candles, # red candles - volume in those candles, Ratio - g/r candles, g-volume/r-volume

Gracias!
Try this:

Ruby:
input NYOpen = 0930;
def isNYOpen = secondsFromTime(NYOpen) == 0;
def isUp = close > open;
def isDown = close < open;

def bullCount = if isNYOpen then 0 else if isUp then bullCount[1] + 1 else bullCount[1];
def bullVolume =  if isNYOpen then 0 else if isUp then bullVolume[1] + volume else bullVolume[1];
AddLabel(yes,bullCount + " (" + bullVolume + ")",Color.GREEN);

def bearCount = if isNYOpen then 0 else if isDown then bearCount[1] + 1 else bearCount[1];
def bearVolume = if isNYOpen then 0 else if isDown then bearVolume[1] + volume else bearVolume[1];
AddLabel(yes,bearCount + " (" + bearVolume + ")", Color.RED);

AddLabel(yes,"Ratio: " + Round((bullCount/bearCount),1) + " | " + Round((bullVolume/bearVolume),1), Color.WHITE);

Try this:

Ruby:
input NYOpen = 0930;
def isNYOpen = secondsFromTime(NYOpen) == 0;
def isUp = close > open;
def isDown = close < open;

def bullCount = if isNYOpen then 0 else if isUp then bullCount[1] + 1 else bullCount[1];
def bullVolume =  if isNYOpen then 0 else if isUp then bullVolume[1] + volume else bullVolume[1];
AddLabel(yes,bullCount + " (" + bullVolume + ")",Color.GREEN);

def bearCount = if isNYOpen then 0 else if isDown then bearCount[1] + 1 else bearCount[1];
def bearVolume = if isNYOpen then 0 else if isDown then bearVolume[1] + volume else bearVolume[1];
AddLabel(yes,bearCount + " (" + bearVolume + ")", Color.RED);

AddLabel(yes,"Ratio: " + Round((bullCount/bearCount),1) + " | " + Round((bullVolume/bearVolume),1), Color.WHITE);

My man!

Thanks so much, super helpful, appreciated!

Apologies if this has been done before, i couldnt find it.

I am looking for a study that puts a label on my chart. What it does is add up the volume candles that are green on the day so far and display that in a label, then do the same for red and display that, then display a ratio green volume/red volume multiple.. ignores true doji candles (open price = close price)

So on the one minute chart it just gives you (a) the volume sum to the current minute of all the green 1 minute candles, (b) volume sum of all the red 1 minute candles and (c) a/b ...

Does that exist or can anyone create?

Many thanks
try this, Up/Dn volume strength. very helpful indicator.

Last edited by a moderator:
Try this:

Ruby:
input NYOpen = 0930;
def isNYOpen = secondsFromTime(NYOpen) == 0;
def isUp = close > open;
def isDown = close < open;

def bullCount = if isNYOpen then 0 else if isUp then bullCount[1] + 1 else bullCount[1];
def bullVolume =  if isNYOpen then 0 else if isUp then bullVolume[1] + volume else bullVolume[1];
AddLabel(yes,bullCount + " (" + bullVolume + ")",Color.GREEN);

def bearCount = if isNYOpen then 0 else if isDown then bearCount[1] + 1 else bearCount[1];
def bearVolume = if isNYOpen then 0 else if isDown then bearVolume[1] + volume else bearVolume[1];
AddLabel(yes,bearCount + " (" + bearVolume + ")", Color.RED);

AddLabel(yes,"Ratio: " + Round((bullCount/bearCount),1) + " | " + Round((bullVolume/bearVolume),1), Color.WHITE);

Seems to be not counting the opening candle... it works if i move the open time back otherwise doesn't...

Does it work on all timeframes? I tried on the 4 hour and it definitely counts way more candles than jsut however many 4hr ones there have been on the day. 1 hour seems off too...

If i change the time does it count PM? Eg if i change NY open to 7:00 will it start counting at 7am? [absent the 4 hour issue i noted]

Last edited:

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