Color Coding Timelines on 5 Minutes Charts

PaulS

New member
VIP
ToS allows you to identify Pre-Market and Post-Market activity on the charts by greying out those times. Does anybody know of a way to grey out times within normal market hours? I am on the west coast, would like the ability to possibly grey out east coast lunch hour, maybe power hour at the end of the day. or even the hours between the opening and ending hour of the day.

Any help would be appreciated.
 
Solution
I downloaded the links, the 3rd linked worked but shades went only to high and low instead of shading between 2 times without high and low. I tried the make the change and kept getting invalid statement, I combined the lines but then it shaded all times, I couldn't figure out how to get it to understand I only wanted to shade between 10:30est to 14:45est. I have to let you know code is like a foreign language to me which I flunked in school. Please don't take time out of your day to recommend an adjustment, I am in no rush, just pleased you are responding. Thank you.

This is intended to "gray" the area between the 1030-1445 est.

Capture.jpg
Code:
def range = SecondsFromTime(1030) >= 0 and SecondsFromTime(1445) <= 0...
ToS allows you to identify Pre-Market and Post-Market activity on the charts by greying out those times. Does anybody know of a way to grey out times within normal market hours? I am on the west coast, would like the ability to possibly grey out east coast lunch hour, maybe power hour at the end of the day. or even the hours between the opening and ending hour of the day.

Any help would be appreciated.

there are a few studies on here where if the current bar is between 2 times, to determine to do something.

this uses just 2 dates. the times would need to be added in.
https://usethinkscript.com/threads/shade-area-between-2-dates.11157/#post-97635

uses start and stop time to define a period
https://usethinkscript.com/threads/...itical-and-horizontal-lines.11440/#post-99585


Here is one that I made, to identify high and low, between 2 times during a day.
https://usethinkscript.com/threads/average-daily-range-indicator-for-thinkorswim.244/#post-66296
 
Last edited:
Thanks but I am not looking at highs or lows, just want to identify a time frame (for example) during the day, say between 9:00am and 10:00am that the chart will be shaded similar to aftermarket (Pre and Post market shaded on chart). I am a scalper so as I determine the time frames where I am the most productive or least productive, I'd like to grey those areas so I can easily determine my actions and non-actions. I know I can just look at the clock but I guess I am just looking at spoiling myself by having the chart tell me.
 
Thanks but I am not looking at highs or lows, just want to identify a time frame (for example) during the day, say between 9:00am and 10:00am that the chart will be shaded similar to aftermarket (Pre and Post market shaded on chart). I am a scalper so as I determine the time frames where I am the most productive or least productive, I'd like to grey those areas so I can easily determine my actions and non-actions. I know I can just look at the clock but I guess I am just looking at spoiling myself by having the chart tell me.

sorry, i am currently away from my computer and can just look up links and make simple codes, on my cell.

did you look at those links?
the first 2 were enough to put something together.

the 3rd link will shade an area between 2 times. sure , it's longer than needed for your purpose, but you could remove extra codes.


the last line , in the 3rd link, could be changed from this...
shades from low to high,

AddCloud(hiline2, loline2, GlobalColor( "shade1" ), GlobalColor( "shade1" ) );

to this,
to shade from bottom of chart to the top

AddCloud(
double.negative_infinity,
double.positive_infinity,
, GlobalColor( "shade1" ), GlobalColor( "shade1" ) );
 
sorry, i am currently away from my computer and can just look up links and make simple codes, on my cell.

did you look at those links?
the first 2 were enough to put something together.

the 3rd link will shade an area between 2 times. sure , it's longer than needed for your purpose, but you could remove extra codes.


the last line , in the 3rd link, could be changed from this...
shades from low to high,

AddCloud(hiline2, loline2, GlobalColor( "shade1" ), GlobalColor( "shade1" ) );

to this,
to shade from bottom of chart to the top

AddCloud(
double.negative_infinity,
double.positive_infinity,
, GlobalColor( "shade1" ), GlobalColor( "shade1" ) );

I downloaded the links, the 3rd linked worked but shades went only to high and low instead of shading between 2 times without high and low. I tried the make the change and kept getting invalid statement, I combined the lines but then it shaded all times, I couldn't figure out how to get it to understand I only wanted to shade between 10:30est to 14:45est. I have to let you know code is like a foreign language to me which I flunked in school. Please don't take time out of your day to recommend an adjustment, I am in no rush, just pleased you are responding. Thank you.
 
I downloaded the links, the 3rd linked worked but shades went only to high and low instead of shading between 2 times without high and low. I tried the make the change and kept getting invalid statement, I combined the lines but then it shaded all times, I couldn't figure out how to get it to understand I only wanted to shade between 10:30est to 14:45est. I have to let you know code is like a foreign language to me which I flunked in school. Please don't take time out of your day to recommend an adjustment, I am in no rush, just pleased you are responding. Thank you.

This is intended to "gray" the area between the 1030-1445 est.

Capture.jpg
Code:
def range = SecondsFromTime(1030) >= 0 and SecondsFromTime(1445) <= 0;
AddCloud(if  range
         then Double.POSITIVE_INFINITY
         else Double.NaN,
         Double.NEGATIVE_INFINITY,
         Color.GRAY, Color.GRAY);
 
Solution

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
368 Online
Create Post

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