#Volume 5m and 1m displayed on 1m chart with vertical time separations @5m
plot v1 = volume(period=aggregationPeriod.min);
v1.setpaintingStrategy(paintingStrategy.HISTOGRAM);
v1.setdefaultColor(color.white);
plot v5=volume(period=aggregationPeriod.FIVE_MIN);
v5.setpaintingStrategy(paintingStrategy.HISTOGRAM);
v5.assignvalueColor(if close(period=aggregationPeriod.five_min) > open(period=aggregationPeriod.FIVE_MIN) then color.green else color.red);
# Vertical Lines @Start Time and then Interval of Minutes
input begin = 0930;
input minutes = 5;
def chartAgg = GetAggregationPeriod();
def barSeq = if SecondsTillTime(begin) == 0 and
SecondsFromTime(begin) == 0
then 0
else barSeq[1] + 1;
def BarsPerHour = 60 / (chartAgg / 1000 / 60);
def bar = barSeq;
def barCount = CompoundValue(1, if bar % BarsPerHour == 0
then (bar / BarsPerHour) - 1
else Double.NaN, 1);
# barCount.SetPaintingStrategy(PaintingStrategy.Values_Below);
input showlabels = no;
AddLabel(showlabels, "Bars Per Hour: " + BarsPerHour +
" Current Bar In Sequence: " + bar,
if !IsNaN(barCount)
then Color.GREEN
else Color.WHITE);
AddLabel(showlabels, bar + " " + minutes / (GetAggregationPeriod() / 60000));
input vertical_plot_limiter = 10000;
def lastbar = if !IsNaN(close) and IsNaN(close[-1]) then BarNumber() else Double.NaN;
################
###########
input timezone = {default "ET", "CT", "MT", "PT"};
def starthour = (if timezone == timezone."ET"
then 9
else if timezone == timezone."CT"
then 8
else if timezone == timezone."MT"
then 7
else 6) ;
def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def mins = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;
AddVerticalLine(BarNumber() >= HighestAll(lastbar) - vertical_plot_limiter and (bar) % (minutes / (GetAggregationPeriod() / 60000)) == 0, hour + ":" +
if mins < 10
then "0" + mins
else "" + mins, color = Color.white, stroke = Curve.FIRM);