#OHLC_Time_Hour_Minutes_Bubble
input time = 1800;
#Find time closest to time input if that time does not exist on chart
def cond = SecondsFromTime(time)[1] < 0 and SecondsFromTime(time) >= 0;
def stock = TickValue() == .01;
#Find values at cond
def otime = if cond then open else otime[1];
def ctime = if cond then close else ctime[1];
def htime = if cond then high else htime[1];
def ltime = if cond then low else ltime[1];
plot opentime = otime;
plot closetime = ctime;
plot hightime = htime;
plot lowtime = ltime;
opentime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
closetime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
hightime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lowtime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DefineGlobalColor("H", Color.GREEN);
DefineGlobalColor("L", Color.RED);
DefineGlobalColor("O", Color.WHITE);
DefineGlobalColor("C", Color.YELLOW);
opentime.SetDefaultColor(GlobalColor("O"));
closetime.SetDefaultColor(GlobalColor("C"));
hightime.SetDefaultColor(GlobalColor("H"));
lowtime.SetDefaultColor(GlobalColor("L"));
#Find time (hours and minutes) closest to time input
#Time zone
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 + (if TickValue() == 10 then 0 else 30)) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;
def bn = BarNumber();
#def bartime = if cond then bn else bartime[1];
def hrtime = if cond then (if !stock and hour < 0 then (24 + hour) else hour) else hrtime[1];
def mintime = if cond then minutes else mintime[1];
#addchartBubble(1, low, hour+"\n"+hrtime, color.gray, no);
#Bubbles
input last_bubble = yes;
input bar_bubble = yes;
input bubblemover = 2;
def b = bubblemover;
def b1 = b + 1;
def mover = IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]);
#Last Bubbles in Right Expansion
AddChartBubble(last_bubble and mover, opentime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "Open - " + opentime, GlobalColor("O"), if closetime > opentime then no else yes);
AddChartBubble(last_bubble and mover, closetime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "Close - " + closetime, GlobalColor("C"), if closetime > opentime then yes else no);
AddChartBubble(last_bubble and mover, hightime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "High - " + hightime, GlobalColor("H"));
AddChartBubble(last_bubble and mover, lowtime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "Low - " + lowtime, GlobalColor("L"), no);
#Bubble at bar where time closest to time input occured
AddChartBubble(bar_bubble and cond, low, hrtime + ":" + (if (if TickValue() == 10 and minutes >= 30 then (minutes - 30) else minutes) < 10 then "0" else "") + (if TickValue() == 10 and minutes >= 30 then (minutes - 30) else minutes), Color.WHITE, no);
input verticalline = yes;
AddVerticalLine(verticalline and cond, " ", stroke = Curve.FIRM);
#