script philow {
input n = 1;
def ymd = GetYYYYMMDD();
def ok = !IsNaN(close);
def capture = ok and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture
then dayCount[1] + 1
else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
def cc = CompoundValue(1, if thisDay == n and secondstillTime(1600)>=0
then close
else cc[1], close);
def ccnan = if IsNaN(cc) then ccnan[1] else cc;
plot ccplot = if thisDay == n and SecondsFromTime(1600) < 0
then Double.NaN
else if thisDay <= n
then (ccnan)
else Double.NaN;
}
#Plots of Highs/Lows/Opens/Closes based upon script...add more days using similar plot statements, increasing the value by 1
input showplots = yes;
plot C1 = philow(1).ccplot;
plot C2 = philow(2).ccplot;
plot C3 = philow(3).ccplot;
plot C4 = philow(4).ccplot;
plot C5 = philow(5).ccplot;
C1.setdefaultColor(color.yellow);
C2.setdefaultColor(color.yellow);
C3.setdefaultColor(color.yellow);
C4.setdefaultColor(color.yellow);
C5.setdefaultColor(color.yellow);
c1.sethiding(!showplots);
c2.sethiding(!showplots);
c3.sethiding(!showplots);
c4.sethiding(!showplots);
c5.sethiding(!showplots);
input showbubbles_Prior_OHLC = yes;
input n = 5;
def n1 = n + 1;
def StartPlot = if showbubbles_Prior_OHLC == yes
then (IsNaN(close[n]) and !IsNaN(close[n1]))
else Double.NaN;
AddChartBubble(StartPlot, Round(c1[n1], 2), "PC1-" + astext(Round(c1[n1], 2)), Color.YELLOW, yes);
AddChartBubble(StartPlot, Round(c2[n1], 2), "PC2-" + astext(Round(c2[n1], 2)), Color.YELLOW, yes);
AddChartBubble(StartPlot, Round(c3[n1], 2), "PC3-" + astext(Round(c3[n1], 2)), Color.YELLOW, yes);
AddChartBubble(StartPlot, Round(c4[n1], 2), "PC4-" + astext(Round(c4[n1], 2)), Color.YELLOW, yes);
AddChartBubble(StartPlot, Round(c5[n1], 2), "PC5-" + astext(Round(c5[n1], 2)), Color.YELLOW, yes);