#Usethinkscript request - Prior Bar OHLC extended right and 2 days to the left with price displayed
def lastbar = if IsNaN(close[-1]) and !IsNaN(close) then BarNumber() else Double.NaN;
def dayCount = CompoundValue(1, if GetYYYYMMDD() != GetYYYYMMDD()[1] then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
input bars_back = 1;
input days_displayed = 2;
def v_priorbarclose = HighestAll(if BarNumber() == HighestAll(lastbar - bars_back) then close else Double.NaN);
plot p_priorbarclose = if thisDay < days_displayed + 1 then v_priorbarclose else Double.NaN;
AddChartBubble(BarNumber() == HighestAll(BarNumber()),
p_priorbarclose,
"C:" + Astext(v_priorbarclose), Color.WHITE);
def v_priorbaropen = HighestAll(if BarNumber() == HighestAll(lastbar - bars_back) then open else Double.NaN);
plot p_priorbaropen = if thisDay < days_displayed + 1 then v_priorbaropen else Double.NaN;
AddChartBubble(BarNumber() == HighestAll(BarNumber()),
p_priorbaropen,
"O:" + Astext(v_priorbaropen), Color.WHITE);
def v_priorbarhigh = HighestAll(if BarNumber() == HighestAll(lastbar - bars_back) then high else Double.NaN);
plot p_priorbarhigh = if thisDay < days_displayed + 1 then v_priorbarhigh else Double.NaN;
AddChartBubble(BarNumber() == HighestAll(BarNumber()),
p_priorbarhigh,
"H:" + Astext(v_priorbarhigh), Color.WHITE);
def v_priorbarlow = HighestAll(if BarNumber() == HighestAll(lastbar - bars_back) then low else Double.NaN);
plot p_priorbarlow = if thisDay < days_displayed + 1 then v_priorbarlow else Double.NaN;
AddChartBubble(BarNumber() == HighestAll(BarNumber()),
p_priorbarlow,
"L:" + Astext(v_priorbarlow), Color.WHITE, no);