#830_Vertical_Open
script x {
input lookback = 0;
input openingTime2 = 0830;
def ymd = GetYYYYMMDD();
def candles = !IsNaN(close);
def capture = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) + 1;
def sec2 = SecondsFromTime(openingTime2);
def isTime2 = (sec2 >= 0 and sec2[1] < 0) or (sec2 < sec2[1] and sec2 >= 0);
def op2 = if IsNaN(close) then op2[1] else if thisDay == lookback and isTime2 then open else op2[1];
plot open2 = if thisDay > lookback and isTime2 then Double.NaN else op2[1];
def mon = if thisDay == lookback then GetMonth() else mon[1];
def day = if thisDay == lookback then GetDayOfMonth(GetYYYYMMDD()) else day[1];
plot m = mon;
plot d = day;
}
input showverticals = yes;
input openingTime2 = 0830;
input showbubble = yes;
input showlabel = yes;
def sec2 = SecondsFromTime(openingTime2);
def isTime2 = (sec2 >= 0 and sec2[1] < 0) or (sec2 < sec2[1] and sec2 >= 0);
plot o1 = x(lookback = 1);
o1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot o2 = x(lookback = 2);
o2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot o3 = x(lookback = 3);
o3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot o4 = x(lookback = 4);
o4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot o5 = x(lookback = 5);
o5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DefineGlobalColor("X", Color.CYAN);
o1.SetDefaultColor(GlobalColor("X"));
o2.SetDefaultColor(GlobalColor("X"));
o3.SetDefaultColor(GlobalColor("X"));
o4.SetDefaultColor(GlobalColor("X"));
o5.SetDefaultColor(GlobalColor("X"));
AddLabel(showlabel, "Open Time = " + openingTime2, Color.CYAN);
input bubblemover = 3;
def bm = bubblemover;
def bm1 = bm + 1;
AddVerticalLine(if !showverticals then Double.NaN else isTime2, AsPrice(GetYYYYMMDD()), o1.TakeValueColor(), Curve.FIRM);
AddChartBubble(showbubble and IsNaN(close[bm]) and !IsNaN(close[bm1]), o1[bm1], +x(1).m + "/" + x(1).d, o1.TakeValueColor(), yes);
AddChartBubble(showbubble and IsNaN(close[bm]) and !IsNaN(close[bm1]), o2[bm1], +x(2).m + "/" + x(2).d, o2.TakeValueColor(), yes);
AddChartBubble(showbubble and IsNaN(close[bm]) and !IsNaN(close[bm1]), o3[bm1], +x(3).m + "/" + x(3).d, o3.TakeValueColor(), yes);
AddChartBubble(showbubble and IsNaN(close[bm]) and !IsNaN(close[bm1]), o4[bm1], +x(4).m + "/" + x(4).d, o4.TakeValueColor(), yes);
AddChartBubble(showbubble and IsNaN(close[bm]) and !IsNaN(close[bm1]), o5[bm1], +x(5).m + "/" + x(5).d, o4.TakeValueColor(), yes);