Horizontal and Vertical Line at Open

jmaxfl

New member
VIP
I am creating a script for myself that plots a Horizontal and a Vertical Line at the Open, and Vertical Lines at 10:00 and another at 15:30 EST. I have used examples here to create what I have, thanks to all of you. I would like to be able to change the color, curve and description in properties Here is the script as far as I have been able to create it. I suspect it is a quick fix for someone who knows the language.

CODE:
Code:
# Create Horizontal and Vertical lines at Open. Vertical lines at 9:00 EST and 1530 EST.

def na = Double.NaN;

# open/close times (EST)
input start = 0930;
input end = 1600;

def dayopen = if SecondsTillTime(start) == 0 then 1 else 0;
def daytime = if SecondsFromTime(start) >= 0 and SecondsTillTime(end) > 0 then 1 else 0;

def openbar = if !daytime then na
else if dayopen then open
else openbar[1];

plot ob1 = openbar;
ob1.SetDefaultColor(Color.WHITE);
ob1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ob1.HideBubble();

# AddVerticalLines
input targetTime1000 = 1000;
input targetTime1530 = 1530;
input showverticals = yes;

def tt2 = SecondsFromTime(targetTime1000) == 0;
AddVerticalLine(tt2, " 1st Half Hour", Color.WHITE, Curve.SHORT_DASH );

def tt3 = SecondsFromTime(targetTime1530) == 0;
AddVerticalLine(tt3, " Last Half Hour", Color.WHITE, Curve.SHORT_DASH );
 
Last edited by a moderator:
I am creating a script for myself that plots a Horizontal and a Vertical Line at the Open, and Vertical Lines at 10:00 and another at 15:30 EST. I have used examples here to create what I have, thanks to all of you. I would like to be able to change the color, curve and description in properties Here is the script as far as I have been able to create it. I suspect it is a quick fix for someone who knows the language.

CODE:
Code:
# Create Horizontal and Vertical lines at Open. Vertical lines at 9:00 EST and 1530 EST.

def na = Double.NaN;

# open/close times (EST)
input start = 0930;
input end = 1600;

def dayopen = if SecondsTillTime(start) == 0 then 1 else 0;
def daytime = if SecondsFromTime(start) >= 0 and SecondsTillTime(end) > 0 then 1 else 0;

def openbar = if !daytime then na
else if dayopen then open
else openbar[1];

plot ob1 = openbar;
ob1.SetDefaultColor(Color.WHITE);
ob1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ob1.HideBubble();

# AddVerticalLines
input targetTime1000 = 1000;
input targetTime1530 = 1530;
input showverticals = yes;

def tt2 = SecondsFromTime(targetTime1000) == 0;
AddVerticalLine(tt2, " 1st Half Hour", Color.WHITE, Curve.SHORT_DASH );

def tt3 = SecondsFromTime(targetTime1530) == 0;
AddVerticalLine(tt3, " Last Half Hour", Color.WHITE, Curve.SHORT_DASH );

change color using RGB colors
https://usethinkscript.com/threads/...for-custom-watchlist-column.10675/#post-94315


change color using getcolor()
https://usethinkscript.com/threads/...n-ema-10-cross-above-ema20.16402/#post-130619
# ema10_cross_20_chg

# color choose
# this doesn't assign the color in quotes.
# the location of the picked color , in the series, is changed to a number for getcolor()
# ex. pink is the 3rd number. 3 is sent to getcolor()
# look up getcolor() to see the sequence of colors
input Color1_choice = {default "magenta", "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};
 

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

change color using RGB colors
https://usethinkscript.com/threads/...for-custom-watchlist-column.10675/#post-94315


change color using getcolor()
https://usethinkscript.com/threads/...n-ema-10-cross-above-ema20.16402/#post-130619
# ema10_cross_20_chg

# color choose
# this doesn't assign the color in quotes.
# the location of the picked color , in the series, is changed to a number for getcolor()
# ex. pink is the 3rd number. 3 is sent to getcolor()
# look up getcolor() to see the sequence of colors
input Color1_choice = {default "magenta", "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};
Thanks working on adding this option to the script, I can still use some help in figuring out why the vertical line at Open is not rendering.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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