chiropteraphile/crow
New member
Plots the prior day settlement (4:15pm est) as a solid white line, and current day open (9:30am est) as a short white dash, 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);
def RTHrange = priorRTHhigh - priorRTHlow;
def sumHighLow = priorRTHhigh + priorRTHlow;
# OPEN VALUE
input opentime = {default Manual, Globex, Midnight, RTHstart};
input endtime = {default Manual, Globex, Midnight, RTHend};
input openTimeClock = 0930;
def globextime = GetYYYYMMDD() != GetYYYYMMDD()[1];
def midnighttime = SecondsFromTime(0000) == 0;
def RTHstarttime = GetTime() crosses above RegularTradingStart(GetYYYYMMDD());
def RTHendtime = (1615);
def openValue;
switch (opentime) {
case Manual:
openValue = if SecondsFromTime(openTimeClock) == 0 then open else openValue[1];
case Globex:
openValue = if globextime then open else openValue[1];
case Midnight:
openValue = if midnighttime then open else openValue[1];
case RTHstart:
openValue = if RTHstarttime then open else openValue[1];
}
# SETTLMENT VALUE
input settlementTime = {default Manual, PreMarketend, RTHend, EXTend};
input settlementTimeClock = 1615;
def PreMarketend = gettime() crosses above regularTradingStart(getyyyYMMDD());
def RTHend = secondsfromtime(1615) == 0;
def EXTend = GetTime() crosses above RegularTradingEnd(GetYYYYMMDD());
def settlementValue;
switch (settlementTime) {
case Manual:
settlementValue = if SecondsFromTime(settlementTimeClock) == 0 then close else settlementValue[1];
case PreMarketend:
settlementValue = if PreMarketend then close[1] else settlementValue[1];
case RTHend:
settlementValue = if RTHend then close else settlementValue[1];
case EXTend:
settlementValue = if EXTend then close else settlementValue[1];
}
plot settlementPrice = settlementValue;
settlementPrice.SetDefaultColor(Color.White);
settlementPrice.SetStyle(Curve.Firm);
settlementPrice.SetLineWeight(1);
settlementPrice.HideBubble();
settlementPrice.HideTitle();
plot openPrice = openValue;
openPrice.SetDefaultColor(Color.White);
openPrice.SetStyle(Curve.Short_Dash);
openPrice.SetLineWeight(1);
openPrice.HideBubble();
openPrice.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);
def RTHrange = priorRTHhigh - priorRTHlow;
def sumHighLow = priorRTHhigh + priorRTHlow;
# OPEN VALUE
input opentime = {default Manual, Globex, Midnight, RTHstart};
input endtime = {default Manual, Globex, Midnight, RTHend};
input openTimeClock = 0930;
def globextime = GetYYYYMMDD() != GetYYYYMMDD()[1];
def midnighttime = SecondsFromTime(0000) == 0;
def RTHstarttime = GetTime() crosses above RegularTradingStart(GetYYYYMMDD());
def RTHendtime = (1615);
def openValue;
switch (opentime) {
case Manual:
openValue = if SecondsFromTime(openTimeClock) == 0 then open else openValue[1];
case Globex:
openValue = if globextime then open else openValue[1];
case Midnight:
openValue = if midnighttime then open else openValue[1];
case RTHstart:
openValue = if RTHstarttime then open else openValue[1];
}
# SETTLMENT VALUE
input settlementTime = {default Manual, PreMarketend, RTHend, EXTend};
input settlementTimeClock = 1615;
def PreMarketend = gettime() crosses above regularTradingStart(getyyyYMMDD());
def RTHend = secondsfromtime(1615) == 0;
def EXTend = GetTime() crosses above RegularTradingEnd(GetYYYYMMDD());
def settlementValue;
switch (settlementTime) {
case Manual:
settlementValue = if SecondsFromTime(settlementTimeClock) == 0 then close else settlementValue[1];
case PreMarketend:
settlementValue = if PreMarketend then close[1] else settlementValue[1];
case RTHend:
settlementValue = if RTHend then close else settlementValue[1];
case EXTend:
settlementValue = if EXTend then close else settlementValue[1];
}
plot settlementPrice = settlementValue;
settlementPrice.SetDefaultColor(Color.White);
settlementPrice.SetStyle(Curve.Firm);
settlementPrice.SetLineWeight(1);
settlementPrice.HideBubble();
settlementPrice.HideTitle();
plot openPrice = openValue;
openPrice.SetDefaultColor(Color.White);
openPrice.SetStyle(Curve.Short_Dash);
openPrice.SetLineWeight(1);
openPrice.HideBubble();
openPrice.HideTitle();
#