# How to show Histogram bars side by side and not stacked?

#### greco26

##### Active member
Hi All,

Anyone know how to show histogram bars side by side when comparing 2 sets of data and not stacked? The below code is from a UTS study comparing today's intraday volume vs volume of the same time 24hour ago. Thanks as always!

Code:
``````# prev_day_vol_0

# Getting Yesterdays cumulative volume at today's time

# for charts with a period less than a day.
# get the chart agg time and convert to minutes. then calculate how many bars are in the trading day, on the chart.
def chartagg = GetAggregationPeriod();
def chartmin = chartagg / (1000 * 60);
# 6.5 hours in a normal trading day, 390 minutes.
def daybars = 390/chartmin;

#addlabel(1, "bar min " + chartmin, color.yellow);
#addlabel(1, "bars / day " + daybars, color.yellow);

# 78 for 5min bars
#def daybars = 78;

def isstart = If secondsfromtime(930) == 0 then 1 else 0;
def dayvol = If isstart then volume else if secondsfromtime(930) > 0 and secondstilltime(1600) > 0 then dayvol[1] + volume else dayvol[1];
#def prevdayvol = dayvol[daybars];
def prevdayvol = getvalue(dayvol, daybars);
plot yesterday = prevdayvol;
plot today = dayvol;
yesterday.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
today.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

addlabel(1, "YDA " + prevdayvol, color.yellow);
addlabel(1, "TD " + dayvol, color.yellow);
addlabel(1, "Rvol " + round(dayvol/prevdayvol,2), color.yellow);

input test1_vol_bubbles = yes;
prevdayvol + " prev\n" +
dayvol + " curr"
, (if isstart then color.yellow else color.gray), yes);

Solution
Hi All,

Anyone know how to show histogram bars side by side when comparing 2 sets of data and not stacked? The below code is from a UTS study comparing today's intraday volume vs volume of the same time 24hour ago. Thanks as always!

Code:
``````# prev_day_vol_0

# Getting Yesterdays cumulative volume at today's time

# for charts with a period less than a day.
# get the chart agg time and convert to minutes. then calculate how many bars are in the trading day, on the chart.
def chartagg = GetAggregationPeriod();
def chartmin = chartagg / (1000 * 60);
# 6.5 hours in a normal trading day, 390 minutes.
def daybars = 390/chartmin...``````
Hi All,

Anyone know how to show histogram bars side by side when comparing 2 sets of data and not stacked? The below code is from a UTS study comparing today's intraday volume vs volume of the same time 24hour ago. Thanks as always!

Code:
``````# prev_day_vol_0

# Getting Yesterdays cumulative volume at today's time

# for charts with a period less than a day.
# get the chart agg time and convert to minutes. then calculate how many bars are in the trading day, on the chart.
def chartagg = GetAggregationPeriod();
def chartmin = chartagg / (1000 * 60);
# 6.5 hours in a normal trading day, 390 minutes.
def daybars = 390/chartmin;

#addlabel(1, "bar min " + chartmin, color.yellow);
#addlabel(1, "bars / day " + daybars, color.yellow);

# 78 for 5min bars
#def daybars = 78;

def isstart = If secondsfromtime(930) == 0 then 1 else 0;
def dayvol = If isstart then volume else if secondsfromtime(930) > 0 and secondstilltime(1600) > 0 then dayvol[1] + volume else dayvol[1];
#def prevdayvol = dayvol[daybars];
def prevdayvol = getvalue(dayvol, daybars);
plot yesterday = prevdayvol;
plot today = dayvol;
yesterday.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
today.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

addlabel(1, "YDA " + prevdayvol, color.yellow);
addlabel(1, "TD " + dayvol, color.yellow);
addlabel(1, "Rvol " + round(dayvol/prevdayvol,2), color.yellow);

input test1_vol_bubbles = yes;
prevdayvol + " prev\n" +
dayvol + " curr"
, (if isstart then color.yellow else color.gray), yes);

Since TOS plots a histogram bar occupies one chart bar, then I do not think side by side histogram bars can be meshed together into one bar's space.

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