input begin = 0930;
input minutes = 10;
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);
def lastbar = if !IsNaN(close) and IsNaN(close[-1]) then BarNumber() else Double.NaN;
#Arrow
input showarrow = yes;
input arrow_limiter = 1;
plot arrow = if showarrow and
BarNumber() >= HighestAll(lastbar) - arrow_limiter * (minutes / (GetAggregationPeriod() / 60000)) and
(bar) % (minutes / (GetAggregationPeriod() / 60000)) == 0
then 1 else 0;
arrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#Verticalline
input showvertical = yes;
input vertical_plot_limiter = 1;
AddVerticalLine(showvertical and
BarNumber() >= HighestAll(lastbar) - vertical_plot_limiter * (minutes / (GetAggregationPeriod() / 60000)) and
(bar) % (minutes / (GetAggregationPeriod() / 60000)) == 0,
color = Color.WHITE,
stroke = Curve.FIRM);
#Bubble with time
input showbubble = yes;
input bubble_limiter = 1;
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;
AddChartBubble(showbubble and
BarNumber() >= HighestAll(lastbar) - bubble_limiter * (minutes / (GetAggregationPeriod() / 60000)) and(bar) % (minutes / (GetAggregationPeriod() / 60000)) == 0, low,
hour + ":" +
if mins < 10
then "0" + mins
else "" + mins , Color.WHITE, no);