Premarket Fibonacci

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:
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

  • Captura de ****alla 2025-04-10 092415.jpg
    Captura de ****alla 2025-04-10 092415.jpg
    120.5 KB · Views: 42
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
336 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top