I just got this code for ONH_ONL but this just for a HIGH values. I've tried to add the code for ONL but I cannot make it =( . Please help!
script onh_ {
input daysback = 1;
def ymd = SecondsFromTime(1600) >= 0 or SecondsTillTime(0930) > 0;
def candles = !IsNaN(close);
def capture = ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
input PlotOverNightExtremes = yes;
input DisplayPriceBubbleOnHiLowBar = yes;
input DisplayPriceBubbleOnRightEdge = yes;
def o = open; def h = high; def l = low; def c = close;
def Post = thisday==daysback and secondsFromTime(1600);
def Pre = thisday==daysback and secondsTillTime(930);
def Closed = thisday==daysback and (Post >=0 or Pre>=0);
def bar = BarNumber();
def GlobeX = thisday==daysback and Closed;# GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if thisday==daysback and GlobeX and !GlobeX[1] then h else
if thisday==daysback and GlobeX and h > ONhigh[1] then h else ONhigh[1];
def ONhighBar = if thisday==daysback and GlobeX and h == ONhigh then bar else Double.NaN;
def OverNightHigh = if thisday==daysback and BarNumber() == HighestAll(ONhighBar) then ONhigh else OverNightHigh[1];
plot ONH = if thisday <= daysback and OverNightHigh > 1 then OverNightHigh else Double.NaN;
###
def ONlow = if thisday==daysback and GlobeX and !GlobeX[1] then l else
if thisday==daysback and GlobeX and l < ONlow[1] then l else ONlow[1];
def ONlowBar = if thisday==daysback and GlobeX and l == ONlow then bar else Double.NaN;
def OverNightLOW = if thisday==daysback and BarNumber() == LOWestAll(ONLOWBar) then ONlow else OverNightlow[1];
plot ONL = if thisday >= daysback and OverNightLOW > 1 then OverNightLOW else Double.NaN;
ONL.SetHiding(!PlotOverNightExtremes);
ONL.SetPaintingStrategy(PaintingStrategy.LINE);
ONL.SetDefaultColor(Color.DARK_RED);
ONL.HideBubble();
ONL.HideTitle();
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.LINE);
ONH.SetDefaultColor(Color.BLUE);
ONH.HideBubble();
ONH.HideTitle(); }
plot onh0 = onh_(daysback = 0);
plot onh1 = onh_(daysback = 2);
plot onh2 = onh_(daysback = 4);
plot onh3 = onh_(daysback = 6);
onh0.setdefaultColor(color.blue);
onh1.setdefaultColor(color.blue);
onh2.setdefaultColor(color.blue);
onh3.setdefaultColor(color.blue);
input lineweight = 2;
onh0.setlineweight(lineweight);
onh1.setlineweight(lineweight);
onh2.setlineweight(lineweight);
onh3.setlineweight(lineweight);
addchartbubble(isnan(onh0[1]) and !isnan(onh0),onh0,onh0,createColor(204,204,255));
addchartbubble(isnan(onh1[1]) and !isnan(onh1),onh1,onh1,createColor(204,204,255));
addchartbubble(isnan(onh2[1]) and !isnan(onh2),onh2,onh2,createColor(204,204,255));
addchartbubble(isnan(onh3[1]) and !isnan(onh3),onh3,onh3,createColor(204,204,255));
script onh_ {
input daysback = 1;
def ymd = SecondsFromTime(1600) >= 0 or SecondsTillTime(0930) > 0;
def candles = !IsNaN(close);
def capture = ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
input PlotOverNightExtremes = yes;
input DisplayPriceBubbleOnHiLowBar = yes;
input DisplayPriceBubbleOnRightEdge = yes;
def o = open; def h = high; def l = low; def c = close;
def Post = thisday==daysback and secondsFromTime(1600);
def Pre = thisday==daysback and secondsTillTime(930);
def Closed = thisday==daysback and (Post >=0 or Pre>=0);
def bar = BarNumber();
def GlobeX = thisday==daysback and Closed;# GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if thisday==daysback and GlobeX and !GlobeX[1] then h else
if thisday==daysback and GlobeX and h > ONhigh[1] then h else ONhigh[1];
def ONhighBar = if thisday==daysback and GlobeX and h == ONhigh then bar else Double.NaN;
def OverNightHigh = if thisday==daysback and BarNumber() == HighestAll(ONhighBar) then ONhigh else OverNightHigh[1];
plot ONH = if thisday <= daysback and OverNightHigh > 1 then OverNightHigh else Double.NaN;
###
def ONlow = if thisday==daysback and GlobeX and !GlobeX[1] then l else
if thisday==daysback and GlobeX and l < ONlow[1] then l else ONlow[1];
def ONlowBar = if thisday==daysback and GlobeX and l == ONlow then bar else Double.NaN;
def OverNightLOW = if thisday==daysback and BarNumber() == LOWestAll(ONLOWBar) then ONlow else OverNightlow[1];
plot ONL = if thisday >= daysback and OverNightLOW > 1 then OverNightLOW else Double.NaN;
ONL.SetHiding(!PlotOverNightExtremes);
ONL.SetPaintingStrategy(PaintingStrategy.LINE);
ONL.SetDefaultColor(Color.DARK_RED);
ONL.HideBubble();
ONL.HideTitle();
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.LINE);
ONH.SetDefaultColor(Color.BLUE);
ONH.HideBubble();
ONH.HideTitle(); }
plot onh0 = onh_(daysback = 0);
plot onh1 = onh_(daysback = 2);
plot onh2 = onh_(daysback = 4);
plot onh3 = onh_(daysback = 6);
onh0.setdefaultColor(color.blue);
onh1.setdefaultColor(color.blue);
onh2.setdefaultColor(color.blue);
onh3.setdefaultColor(color.blue);
input lineweight = 2;
onh0.setlineweight(lineweight);
onh1.setlineweight(lineweight);
onh2.setlineweight(lineweight);
onh3.setlineweight(lineweight);
addchartbubble(isnan(onh0[1]) and !isnan(onh0),onh0,onh0,createColor(204,204,255));
addchartbubble(isnan(onh1[1]) and !isnan(onh1),onh1,onh1,createColor(204,204,255));
addchartbubble(isnan(onh2[1]) and !isnan(onh2),onh2,onh2,createColor(204,204,255));
addchartbubble(isnan(onh3[1]) and !isnan(onh3),onh3,onh3,createColor(204,204,255));