chiropteraphile
New member
Plots prior day high (solid green), low (solid red), and halfback (solid dark orange), anchored to globex RTH hours, with current day (dotted green), low (dotted red), and halfback (dotted dark orange), for futures.
Chart timeframe should be XD:XM or similar (not Today:XM).
#
def na = Double.NaN;
def bn = BarNumber();
def h = high;
def l = low;
script prior {
input prior = close;
def priorOf = if prior != prior[1] then prior[1] else priorOf[1];
plot priorBar = priorOf;
}
def cb = HighestAll(if !IsNaN(h) then bn else na);
def time = GetTime();
def rts = RegularTradingStart(GetYYYYMMDD());
def rte = RegularTradingEnd(GetYYYYMMDD());
def RTH = if time crosses above rts
then bn else RTH[1];
def globex = if time crosses below rte
then bn else globex[1];
def priorRTH = prior(RTH);
def priorGlobex = prior(globex);
def hRTH = HighestAll(RTH);
def hGX = HighestAll(globex);
def hPRTH = HighestAll(priorRTH);
def hPGX = HighestAll(priorGlobex);
def gXhigh = HighestAll(if bn >= hGX && bn < hRTH
then h else if hRTH < hGX && bn >= hGX
then h else na);
def gXlow = LowestAll(if bn >= hGX && bn < hRTH
then l else if hRTH < hGX && bn >= hGX
then l else na);
def RTHhigh = HighestAll(if bn >= hRTH && bn < hGX
then h else if hGX < hRTH && bn >= hRTH
then h else na);
def RTHlow = LowestAll(if bn >= hRTH && bn < hGX
then l else if hGX < hRTH && bn >= hRTH
then l else na);
def priorRTHhigh = HighestAll(if bn >= hPRTH
&& bn < if hGX < hRTH then hGX
else hPGX then h else na);
def priorRTHlow = LowestAll(if bn >= hPRTH
&& bn < if hGX < hRTH then hGX
else hPGX then l else na);
plot
PriorHigh = priorRTHhigh;
PriorHigh.SetDefaultColor(Color.Green);
PriorHigh.SetPaintingStrategy(PaintingStrategy.Line);
PriorHigh.SetStyle(Curve.Firm);
PriorHigh.SetLineWeight(2);
PriorHigh.HideBubble();
PriorHigh.HideTitle();
plot
PriorLow = priorRTHlow;
PriorLow.SetDefaultColor(Color.Red);
PriorLow.SetPaintingStrategy(PaintingStrategy.Line);
PriorLow.SetStyle(Curve.Firm);
PriorLow.SetLineWeight(2);
PriorLow.HideBubble();
PriorLow.HideTitle();
plot PriorHalfback = (priorRTHhigh + priorRTHlow) / 2 ;
PriorHalfback.SetDefaultColor(Color.Dark_Orange);
PriorHalfback.SetPaintingStrategy(PaintingStrategy.Line);
PriorHalfback.SetStyle(Curve.Firm);
PriorHalfback.SetLineWeight(2);
PriorHalfback.HideBubble();
PriorHalfback.HideTitle();
plot
CurrentHigh = RTHhigh;
CurrentHigh.SetDefaultColor(Color.Green);
CurrentHigh.SetPaintingStrategy(PaintingStrategy.Line);
CurrentHigh.SetStyle(Curve.Short_Dash);
CurrentHigh.SetLineWeight(1);
CurrentHigh.HideBubble();
CurrentHigh.HideTitle();
plot
CurrentLow = RTHlow;
CurrentLow.SetDefaultColor(Color.Red);
CurrentLow.SetPaintingStrategy(PaintingStrategy.Line);
CurrentLow.SetStyle(Curve.Short_Dash);
CurrentLow.SetLineWeight(1);
CurrentLow.HideBubble();
CurrentLow.HideTitle();
plot Halfback = (RTHhigh + RTHlow) / 2 ;
Halfback.SetDefaultColor(Color.Dark_Orange);
Halfback.SetPaintingStrategy(PaintingStrategy.Line);
Halfback.SetStyle(Curve.Short_Dash);
Halfback.SetLineWeight(1);
Halfback.HideBubble();
Halfback.HideTitle();
#
Chart timeframe should be XD:XM or similar (not Today:XM).
#
def na = Double.NaN;
def bn = BarNumber();
def h = high;
def l = low;
script prior {
input prior = close;
def priorOf = if prior != prior[1] then prior[1] else priorOf[1];
plot priorBar = priorOf;
}
def cb = HighestAll(if !IsNaN(h) then bn else na);
def time = GetTime();
def rts = RegularTradingStart(GetYYYYMMDD());
def rte = RegularTradingEnd(GetYYYYMMDD());
def RTH = if time crosses above rts
then bn else RTH[1];
def globex = if time crosses below rte
then bn else globex[1];
def priorRTH = prior(RTH);
def priorGlobex = prior(globex);
def hRTH = HighestAll(RTH);
def hGX = HighestAll(globex);
def hPRTH = HighestAll(priorRTH);
def hPGX = HighestAll(priorGlobex);
def gXhigh = HighestAll(if bn >= hGX && bn < hRTH
then h else if hRTH < hGX && bn >= hGX
then h else na);
def gXlow = LowestAll(if bn >= hGX && bn < hRTH
then l else if hRTH < hGX && bn >= hGX
then l else na);
def RTHhigh = HighestAll(if bn >= hRTH && bn < hGX
then h else if hGX < hRTH && bn >= hRTH
then h else na);
def RTHlow = LowestAll(if bn >= hRTH && bn < hGX
then l else if hGX < hRTH && bn >= hRTH
then l else na);
def priorRTHhigh = HighestAll(if bn >= hPRTH
&& bn < if hGX < hRTH then hGX
else hPGX then h else na);
def priorRTHlow = LowestAll(if bn >= hPRTH
&& bn < if hGX < hRTH then hGX
else hPGX then l else na);
plot
PriorHigh = priorRTHhigh;
PriorHigh.SetDefaultColor(Color.Green);
PriorHigh.SetPaintingStrategy(PaintingStrategy.Line);
PriorHigh.SetStyle(Curve.Firm);
PriorHigh.SetLineWeight(2);
PriorHigh.HideBubble();
PriorHigh.HideTitle();
plot
PriorLow = priorRTHlow;
PriorLow.SetDefaultColor(Color.Red);
PriorLow.SetPaintingStrategy(PaintingStrategy.Line);
PriorLow.SetStyle(Curve.Firm);
PriorLow.SetLineWeight(2);
PriorLow.HideBubble();
PriorLow.HideTitle();
plot PriorHalfback = (priorRTHhigh + priorRTHlow) / 2 ;
PriorHalfback.SetDefaultColor(Color.Dark_Orange);
PriorHalfback.SetPaintingStrategy(PaintingStrategy.Line);
PriorHalfback.SetStyle(Curve.Firm);
PriorHalfback.SetLineWeight(2);
PriorHalfback.HideBubble();
PriorHalfback.HideTitle();
plot
CurrentHigh = RTHhigh;
CurrentHigh.SetDefaultColor(Color.Green);
CurrentHigh.SetPaintingStrategy(PaintingStrategy.Line);
CurrentHigh.SetStyle(Curve.Short_Dash);
CurrentHigh.SetLineWeight(1);
CurrentHigh.HideBubble();
CurrentHigh.HideTitle();
plot
CurrentLow = RTHlow;
CurrentLow.SetDefaultColor(Color.Red);
CurrentLow.SetPaintingStrategy(PaintingStrategy.Line);
CurrentLow.SetStyle(Curve.Short_Dash);
CurrentLow.SetLineWeight(1);
CurrentLow.HideBubble();
CurrentLow.HideTitle();
plot Halfback = (RTHhigh + RTHlow) / 2 ;
Halfback.SetDefaultColor(Color.Dark_Orange);
Halfback.SetPaintingStrategy(PaintingStrategy.Line);
Halfback.SetStyle(Curve.Short_Dash);
Halfback.SetLineWeight(1);
Halfback.HideBubble();
Halfback.HideTitle();
#