• Get $40 off VIP by signing up for a free account! Sign Up

AssignBackground Based On First 15 Minutes Of Open.

andreythedon

New member
My objective is to paint the chart black during the first 15 minutes of open....to discourage trading that time!!!!
How do I define the time element?
 
Last edited by a moderator:
Solution
My objective is to paint the chart black during the first 15 minutes of open....to discourage trading that time!!!!
How do I define the time element?
@andreythedon Maybe you could try this code. The time function works, but I haven't tested the HidePricePlot() function (this is actually the first time I've ever coded with it) so this may or may not work.
Code:
def time = if SecondsFromTime(0930) >= 0 and SecondsTillTime(0945) > 0 then yes else no;
HidePricePlot(if time then yes else no);
My objective is to paint the chart black during the first 15 minutes of open....to discourage trading that time!!!!
How do I define the time element?
How about placing a blanket or a pillow over the screen? Probably the easiest. Just kidding around. I have the same problem sometimes breaking my rules "No buying pre-market and to wait 15 mins after the bell". You're not alone. Good Luck! @cabe1332
 
My objective is to paint the chart black during the first 15 minutes of open....to discourage trading that time!!!!
How do I define the time element?
@andreythedon Maybe you could try this code. The time function works, but I haven't tested the HidePricePlot() function (this is actually the first time I've ever coded with it) so this may or may not work.
Code:
def time = if SecondsFromTime(0930) >= 0 and SecondsTillTime(0945) > 0 then yes else no;
HidePricePlot(if time then yes else no);
 
Solution
@andreythedon Maybe you could try this code. The time function works, but I haven't tested the HidePricePlot() function (this is actually the first time I've ever coded with it) so this may or may not work.
Code:
def time = if SecondsFromTime(0930) >= 0 and SecondsTillTime(0945) > 0 then yes else no;
HidePricePlot(if time then yes else no);
Very nice idea!!!! It didn't work right away...but I can work from that I believe. Thanks
 
Hey everyone. I've had fun scripting over the last month!! So to revisit this post. I actually discovered that if you

ASSIGNPRICECOLOR to color.white (or black if your background is black) then the bars dissappear...AWESOME...Turns out it's not helpful during any type of analysis though!! So I went a little less extreme and just painted the bars light gray!!

YAA
 
I use this code that I found here on this forum. Try this, it won't color bars but a chat bubble on the candle. If you are not in east cost change the time inside the "9:45" to display your time zone. Hope this helps.

addchartbubble(secondstilltime(0945)==0,high,"9:45 ",getcolor(6),yes);
 
I think this should work to add color to the first fifteen minutes of a chart.

Code:
def opening_fifteen = if SecondsFromTime(0930) >= 0 and SecondsTillTime(0945) > 0 then 1 else 0;
plot lowside = if opening_fifteen == 1 then Double.NEGATIVE_INFINITY else double.nan;
plot highside = if opening_fifteen == 1 then Double.POSITIVE_INFINITY else double.nan;
AddCloud ( lowside, highside, color.pink, color.pink);

-mashume
 
Last edited:

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