Need Help Extending Lines

AntMan

New member
I need help with a study.. below is the code.. when it's set opentime 0930 and ORend 1600 it draws the lines all the way across the chart, but when I set it to an intraday range, like 0930-1030, the lines stop at 1030 and do not draw to the end of day at 1600.. how do I code it so that the lines draw to end of day no matter what?

also, if anyone can tell me how to post an image, I'd appreciate that too.. I pasted the link but I get a message "Image cannot be loaded from passed link" and I'm unable to just copy & paste an image, so I included a link to the screenshot below.. thanks in advance..

screenshot link

declare hide_on_daily;
input opentime = 0930;
input ORend = 1600;
def na = Double.NaN;
#
# Check if the RTH opening time is now
#
def ORActive = if GetLastDay() == GetDay() and SecondsFromTime(opentime) >= 0 and SecondsFromTime(ORend) < 0 then 1 else 0;
#
# Track the intraday high and low
#
def ORHigh = if ORActive then high else na;
def ORLow = if ORActive then low else na;
#
# Plot the intraday high and low
#
plot ORAH = if GetLastDay() != GetDay() or !ORActive then na else HighestAll(ORHigh);
plot ORAL = if GetLastDay() != GetDay() or !ORActive then na else LowestAll(ORLow);

# Formatting
#
ORAH.SetStyle(Curve.LONG_DASH);
ORAL.SetStyle(Curve.LONG_DASH);
ORAH.SetDefaultColor(Color.RED);
ORAL.SetDefaultColor(Color.GREEN);
 
I need help with a study.. below is the code.. when it's set opentime 0930 and ORend 1600 it draws the lines all the way across the chart, but when I set it to an intraday range, like 0930-1030, the lines stop at 1030 and do not draw to the end of day at 1600.. how do I code it so that the lines draw to end of day no matter what?

also, if anyone can tell me how to post an image, I'd appreciate that too.. I pasted the link but I get a message "Image cannot be loaded from passed link" and I'm unable to just copy & paste an image, so I included a link to the screenshot below.. thanks in advance..

screenshot link

declare hide_on_daily;
input opentime = 0930;
input ORend = 1600;
def na = Double.NaN;
#
# Check if the RTH opening time is now
#
def ORActive = if GetLastDay() == GetDay() and SecondsFromTime(opentime) >= 0 and SecondsFromTime(ORend) < 0 then 1 else 0;
#
# Track the intraday high and low
#
def ORHigh = if ORActive then high else na;
def ORLow = if ORActive then low else na;
#
# Plot the intraday high and low
#
plot ORAH = if GetLastDay() != GetDay() or !ORActive then na else HighestAll(ORHigh);
plot ORAL = if GetLastDay() != GetDay() or !ORActive then na else LowestAll(ORLow);

# Formatting
#
ORAH.SetStyle(Curve.LONG_DASH);
ORAL.SetStyle(Curve.LONG_DASH);
ORAH.SetDefaultColor(Color.RED);
ORAL.SetDefaultColor(Color.GREEN);

Replace your code with this portion, which removed the '!oractive':

Code:
plot ORAH = if GetLastDay() != GetDay() then na else HighestAll(ORHigh);
plot ORAL = if GetLastDay() != GetDay() then na else LowestAll(ORLow);
 

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