Hi,
With following code, I'm only able to plot latest Closed hours High only. Closed hours are between 4:00 PM to 9:30 AM EST.
Is there a way to plot previous Closed hours High also?
Thanks!
With following code, I'm only able to plot latest Closed hours High only. Closed hours are between 4:00 PM to 9:30 AM EST.
Is there a way to plot previous Closed hours High also?
Thanks!
Code:
input PlotOverNightExtremes = yes;
input DisplayPriceBubbleOnHiLowBar = yes;
input DisplayPriceBubbleOnRightEdge = yes;
def o = open;
def h = high;
def l = low;
def c = close;
def Post = secondsFromTime(1600);
def Pre = secondsTillTime(930);
def Closed = Post >=0 or Pre>=0;
def bar = BarNumber();
def GlobeX = Closed;# GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if GlobeX and !GlobeX[1]
then h
else if GlobeX and h > ONhigh[1]
then h
else ONhigh[1];
def ONhighBar = if GlobeX and h == ONhigh
then bar
else Double.NaN;
def ONlow = if GlobeX and !GlobeX[1]
then l
else if GlobeX and l < ONlow[1]
then l
else ONlow[1];
def ONlowBar = if GlobeX and l == ONlow
then bar
else Double.NaN;
def OverNightHigh = if BarNumber() == HighestAll(ONhighBar)
then ONhigh
else OverNightHigh[1];
plot ONH = if OverNightHigh > 0
then OverNightHigh
else Double.NaN;
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.LINE);
ONH.SetDefaultColor(Color.BLUE);
ONH.HideBubble();
ONH.HideTitle();
# Bubble code
AddChartBubble(bar == ONhighBar and PlotOverNightExtremes and DisplayPriceBubbleOnHiLowBar, ONH, "ONH: " + ONH, createColor(204,204,255));
AddChartBubble(barNumber() == highestAll(barnumber()) and PlotOverNightExtremes and DisplayPriceBubbleOnRightEdge, ONH, "ONH: " + ONH, createColor(204,204,255));