Duvan Felipe
New member
Hi, I have this script that only shows up when the market is open. Could someone edit the code so I can see the same thing when the market is closed, meaning pre-market and post-market?
CODE:
CODE:
Code:
def SinValor = Double.NaN;
input Hora_Apertura = 931;
input Hora_Cierre = 1558;
input UnDia = {default "No", "Yes"};
def PrecioCierreAyer = close(period = AggregationPeriod.DAY)[1];
def PrecioApertura = open(period = AggregationPeriod.DAY);
def PrecioActual = close(period = AggregationPeriod.DAY, priceType = PriceType.LAST);
def Diario = Round(((PrecioActual / PrecioCierreAyer) - 1) * 100, 2);
def AltoADC = if PrecioApertura > PrecioCierreAyer or
PrecioActual > PrecioCierreAyer or
high(period = AggregationPeriod.DAY) > PrecioCierreAyer
then high(period = AggregationPeriod.DAY)
else PrecioCierreAyer;
def BajoADC = if PrecioCierreAyer <= low(period = AggregationPeriod.DAY) then PrecioCierreAyer else low(period = AggregationPeriod.DAY);
def Range = Round(AltoADC - BajoADC, 2);
def CALCINIZ1 = if PrecioApertura >= PrecioCierreAyer and
PrecioActual > PrecioCierreAyer and
BajoADC >= PrecioCierreAyer
then PrecioCierreAyer
else if PrecioApertura >= PrecioCierreAyer and
PrecioActual > PrecioCierreAyer and
BajoADC <= PrecioCierreAyer
then low(period = AggregationPeriod.DAY)
else if PrecioApertura >= PrecioCierreAyer and
PrecioActual < PrecioCierreAyer
then high(period = AggregationPeriod.DAY)
else if PrecioApertura <= PrecioCierreAyer and
PrecioActual <= PrecioCierreAyer and
AltoADC <= PrecioCierreAyer
then PrecioCierreAyer
else if PrecioApertura <= PrecioCierreAyer and
PrecioActual <= PrecioCierreAyer and
AltoADC > PrecioCierreAyer
then high(period = AggregationPeriod.DAY)
else if PrecioApertura <= PrecioCierreAyer and
PrecioActual > PrecioCierreAyer
then low(period = AggregationPeriod.DAY)
else SinValor;
def CALCLIMZ1 = if PrecioActual > PrecioCierreAyer then CALCINIZ1 + (Range / 3)
else CALCINIZ1 - (Range / 3);
def CALCINIZ2 = CALCLIMZ1;
def CALCLIMZ2 = if PrecioActual > PrecioCierreAyer then CALCINIZ2 + (Range / 3)
else CALCINIZ2 - (Range / 3);
def CALCINIZ3 = CALCLIMZ2;
def CALCLIMZ3 = if PrecioActual > PrecioCierreAyer then CALCINIZ3 + (Range / 3)
else CALCINIZ3 - (Range / 3);
def OneDay = UnDia;
def ORActive =
if SecondsTillTime(Hora_Cierre) >= 0
and SecondsFromTime(Hora_Apertura) >= 0
then 1
else 0;
def DiaActual =
if OneDay == 0 or
GetDay() == GetLastDay() and
SecondsFromTime(Hora_Apertura) >= 0
then 1 else 0;
plot INICIOZ1 = if ORActive != 1 or DiaActual < 1 then SinValor else CALCINIZ1;
plot LIMITEZ1 = if ORActive != 1 or DiaActual < 1 then SinValor else CALCLIMZ1;
plot INICIOZ2 = if ORActive != 1 or DiaActual < 1 then SinValor else CALCINIZ2;
plot LIMITEZ2 = if ORActive != 1 or DiaActual < 1 then SinValor else CALCLIMZ2;
plot INICIOZ3 = if ORActive != 1 or DiaActual < 1 then SinValor else CALCINIZ3;
plot LIMITEZ3 = if ORActive != 1 or DiaActual < 1 then SinValor else CALCLIMZ3;
INICIOZ1.SetDefaultColor(Color.GRAY);
INICIOZ1.SetStyle(Curve.SHORT_DASH);
INICIOZ1.SetLineWeight(1);
LIMITEZ1.SetDefaultColor(Color.GRAY);
LIMITEZ1.SetStyle(Curve.SHORT_DASH);
LIMITEZ1.SetLineWeight(1);
INICIOZ2.SetDefaultColor(Color.GRAY);
INICIOZ2.SetStyle(Curve.SHORT_DASH);
INICIOZ2.SetLineWeight(1);
LIMITEZ2.SetDefaultColor(Color.GRAY);
LIMITEZ2.SetStyle(Curve.SHORT_DASH);
LIMITEZ2.SetLineWeight(1);
INICIOZ3.SetDefaultColor(Color.GRAY);
INICIOZ3.SetStyle(Curve.SHORT_DASH);
INICIOZ3.SetLineWeight(1);
LIMITEZ3.SetDefaultColor(Color.GRAY);
LIMITEZ3.SetStyle(Curve.SHORT_DASH);
LIMITEZ3.SetLineWeight(1);
AddCloud(LIMITEZ1, INICIOZ1, Color.LIGHT_GREEN, Color.LIGHT_GREEN, yes);
AddCloud(LIMITEZ2, INICIOZ2, Color.LIGHT_GRAY, Color.LIGHT_GRAY, yes);
AddCloud(LIMITEZ3, INICIOZ3, Color.LIGHT_GREEN, Color.LIGHT_GREEN, yes);
Attachments
Last edited by a moderator: