Auto Horizontal Line based on price at 8:30 am New York Times

New member
Hi everyone,
I need an indicator that plots a horizontal line based on price at 8:30 am New York Times. I would like the line to stay on the charts after the market hours. I appreciate your time and help.

Solution
It would basically be:

Code:
``````def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
Y.SetPaintingStrategy(PaintingStrategy.Horizontal);``````
It would basically be:

Code:
``````def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
Y.SetPaintingStrategy(PaintingStrategy.Horizontal);``````

It would basically be:

Code:
``````def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
Y.SetPaintingStrategy(PaintingStrategy.Horizontal);``````
Thank you so much.

It would basically be:

Code:
``````def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
Y.SetPaintingStrategy(PaintingStrategy.Horizontal);``````
Thank you so much for your help. I need your expertise. could you please take a look at the following issue that I have with a watchlist.

I have a watchlist that changes color based on the pivot point. However, it only works during market hours and does not work pre- or after market hours. I was wondering if it could be improved to work both during the regular hours and pre and after market hours. Sometimes it does not change color on certian stocks. I highly appericte it if you could help with fixing it. Below is the code:

# Pivot Points Watchlist Column

input aggregationPeriod = AggregationPeriod.DAY;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];

def PP = (HIGHprev + LOWprev + CLOSEprev) / 3;
def R1 = PP * 2 - LOWprev;
def S1 = PP * 2 - HIGHprev;
def R2 = PP + (HIGHprev - LOWprev);
def S2 = PP - (HIGHprev - LOWprev);
def R3 = PP * 2 + (HIGHprev - 2 * LOWprev);
def S3 = PP * 2 - (2 * HIGHprev - LOWprev);

# Set background color based on conditions
AssignBackgroundColor(
if close >= PP then Color.CYAN
else if close >= S1 then Color.WHITE
else if close >= S2 then Color.DARK_ORANGE
else if close >= S3 then Color.GRAY
else if close >= R1 then Color.Red
else if close >= R2 Then Color.Yellow
else if close >= R3 then color.Green
else Color.current
);

Yeah I can do that maybe tomorrow.

Not the exact question you're looking for?

87k+ Posts
368 Online

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?