chiropteraphile
New member
Plots the overnight high (light green), halfback (dark orange), and low (pink) for futures.
Chart timeframe should be XD:XM or similar (not Today:XM).
#
input PlotOverNightExtremes = yes;
def o = Open;
def h = high;
def l = low;
def c = close;
def v = volume;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if GlobeX and !GlobeX[1]
then v else if GlobeX
then vol[1] + v else Double.NaN;
def GlobeX_Volume = vol;
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];
def OverNightLow = if BarNumber() == HighestAll(ONlowBar)
then ONlow else OverNightLow[1];
plot ONH = if OverNightHigh > 0
then OverNightHigh else Double.NaN;
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.Line);
ONH.SetDefaultColor(Color.Light_Green);
ONH.SetStyle(Curve.Firm);
ONH.SetLineWeight(1);
ONH.HideBubble();
ONH.HideTitle();
plot ONL = if OverNightLow > 0
then OverNightLow
else Double.NaN;
ONL.SetHiding(!PlotOverNightExtremes);
ONL.SetPaintingStrategy(PaintingStrategy.Line);
ONL.SetDefaultColor(Color.Pink);
ONL.SetStyle(Curve.Firm);
ONL.SetLineWeight(1);
ONL.HideBubble();
ONL.HideTitle();
def MaxBar = Max(HighestAll(ONhighBar), HighestAll(ONlowBar));
plot ONHalfback;
ONHalfback = (ONH + ONL) / 2;
ONHalfback.SetDefaultColor(Color.Dark_Orange);
ONHalfback.SetPaintingStrategy(PaintingStrategy.Line);
ONHalfback.SetStyle(Curve.Firm);
ONHalfback.SetLineWeight(1);
ONHalfback.HideBubble();
ONHalfback.HideTitle();
def RTH = SecondsFromTime(0930) >= 0 and SecondsTillTime(1615) > 0;
def Close = SecondsFromTime(1615);
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = yes;
def prevPrice = open(period = aggregationPeriod)[-1];
def price = open(period = aggregationPeriod);
#
Chart timeframe should be XD:XM or similar (not Today:XM).
#
input PlotOverNightExtremes = yes;
def o = Open;
def h = high;
def l = low;
def c = close;
def v = volume;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if GlobeX and !GlobeX[1]
then v else if GlobeX
then vol[1] + v else Double.NaN;
def GlobeX_Volume = vol;
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];
def OverNightLow = if BarNumber() == HighestAll(ONlowBar)
then ONlow else OverNightLow[1];
plot ONH = if OverNightHigh > 0
then OverNightHigh else Double.NaN;
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.Line);
ONH.SetDefaultColor(Color.Light_Green);
ONH.SetStyle(Curve.Firm);
ONH.SetLineWeight(1);
ONH.HideBubble();
ONH.HideTitle();
plot ONL = if OverNightLow > 0
then OverNightLow
else Double.NaN;
ONL.SetHiding(!PlotOverNightExtremes);
ONL.SetPaintingStrategy(PaintingStrategy.Line);
ONL.SetDefaultColor(Color.Pink);
ONL.SetStyle(Curve.Firm);
ONL.SetLineWeight(1);
ONL.HideBubble();
ONL.HideTitle();
def MaxBar = Max(HighestAll(ONhighBar), HighestAll(ONlowBar));
plot ONHalfback;
ONHalfback = (ONH + ONL) / 2;
ONHalfback.SetDefaultColor(Color.Dark_Orange);
ONHalfback.SetPaintingStrategy(PaintingStrategy.Line);
ONHalfback.SetStyle(Curve.Firm);
ONHalfback.SetLineWeight(1);
ONHalfback.HideBubble();
ONHalfback.HideTitle();
def RTH = SecondsFromTime(0930) >= 0 and SecondsTillTime(1615) > 0;
def Close = SecondsFromTime(1615);
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = yes;
def prevPrice = open(period = aggregationPeriod)[-1];
def price = open(period = aggregationPeriod);
#
Last edited: