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.
It would basically be:

def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
It would basically be:

def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;

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

It would basically be:

def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
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
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
addlabel(yes, " ", color.current);

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
258 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.