input begin = 0930;
input end = 1030;
def range = SecondsFromTime(begin) >= 0 and SecondsTillTime(end) >= 0;
def hrange = if range[1] == 0 and range
then high
else if range
then Max(high, hrange[1])
else hrange[1];
def lrange = if range[1] == 0 and range
then low
else if range
then Min(low, lrange[1])
else lrange[1];
def cstart = if range[1] == 0 and range
then close
else cstart[1];
def cend = if range[-1] == 0 and range
then close
else cend[1];
input showlabel = yes;
AddLabel(showlabel, begin + "-" + asprice(end) + " H:" + asdollars(hrange) + " L: " + asdollars(lrange) + " CS: " + asdollars(cstart) + " CE: " + asdollars(cend), Color.YELLOW);
input showplot = yes;
plot xhrange = if !showplot then Double.NaN else hrange;
plot xlrange = if !showplot then Double.NaN else lrange;
plot xcstart = if !showplot then Double.NaN else cstart;
plot xcend = if !showplot then Double.NaN else cend;
xhrange.SetPaintingStrategy(PaintingStrategy.DASHES);
xlrange.SetPaintingStrategy(PaintingStrategy.DASHES);
xcstart.SetPaintingStrategy(PaintingStrategy.DASHES);
xcend.SetPaintingStrategy(PaintingStrategy.DASHES);
input showbubbles = yes;
input bubblemover = 3;
def b = bubblemover;
def b1 = b + 1;
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), xhrange[b], "H", xhrange.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), xlrange[b], "L", xlrange.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), xcstart[b], "CS", xcstart.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), xcend[b], "CE", xcend.TakeValueColor());
;