Do I need to change the timezone in ThinkorSwim?

ezrollin

Member
Everytime I get code from someone else, I notice its coded in the Eastern Time zone. So I automatically change the times to my Central Time. Is ThinkScript hard coded to only deal with Eastern, so I'm messing the script up? Or does it just matter on the individual script? Or is it based on whatever your computer is set to?

Thanks
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
ThinkorSwim operates via eastern time.

For example, the ORB script here. It starts at 930 (regular market hours) and ends at 1000 (30 mins after the market opens). Although I'm from the West Coast, I don't change 930 to 630. The opening time remains the same.

I hope that helps.

Just to be sure, you should always include the specific indicator in question.
 

Tony Stark

New member
hey everyone, question if my chart's x axis is currently propagating in Eastern timezone would I use military time in code for "CloseTime" or I would use Eastern time always?

example:

Code:
input CloseTime = 1600;
input DurationHours = 1;

def durationSec = DurationHours * 60 * 60;
def secondsRemained = SecondsTillTime(closeTime);

plot Price = if secondsRemained >= 0 and secondsRemained <= durationSec then close else double.NaN;

I think I answer my question, the SecondsTillTime Returns the number of seconds till the specified time (24-hour clock notation) in the EST timezone
 

rad14733

Well-known member
VIP
You are correct... New York Stock Exchange, located in New York City, is within the Eastern Standard Time Zone so all securities times are based on EST... That is the center of the financial universe...
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
ThinkorSwim will always use EST time for their script. You can change your platform's timezone, but that shouldn't affect the time input in your indicator. I hope that makes sense.
 

Tony Stark

New member
i try this & still nothing

input OpenTime = 0400;
input DurationHours = 1;
def durationSec = DurationHours * 60 * 60;
def secondsPassed = SecondsFromTime(OpenTime);
plot Price = if secondsPassed >= 0 and secondsPassed <= durationSec then close else Double.NaN;
 

Tony Stark

New member
I have been able to get 4 clock, but it gives me 4 clock every day and I need only the 4pm once a week, any suggestions, ty! My code below:

input OpenTime = 1600;
input DurationHours = .25;
def durationSec = DurationHours * 60 * 60;

def secondsPassed = SecondsFromTime(OpenTime);
def rth = (RegularTradingEnd(GetYYYYMMDD()) - RegularTradingStart(GetYYYYMMDD())) / AggregationPeriod.WEEK;

plot Price = if secondsPassed >= 0 and secondsPassed <= durationSec then close else Double.NaN;
 

Tony Stark

New member
I don't know how to go about it from this point, everything in my code seems logical but now no plot even appears at all in any of the 4pm. Any help would be greatly appreciated.
Here's my progress:


declare hide_on_intraday;
input day_of_week = {default Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
input OpenTime = 1600;
input DurationHours = .25;
def durationSec = DurationHours * 60 * 60;

def secondsPassed = SecondsFromTime(OpenTime);
def rth = ((RegularTradingEnd(GetYYYYMMDD()) - (RegularTradingStart(GetYYYYMMDD()))) / (AggregationPeriod.WEEK));

plot Price = if secondsPassed >= 0 and secondsPassed <= durationSec and GetDayOfWeek(GetYYYYMMDD()) == day_of_week + 1 then close else Double.NaN;
 

Tony Stark

New member
Got it to work!
Here is the code to provided content:

input OpenTime = 1600;
input DurationHours = .25;
def durationSec = DurationHours * 60 * 60;

def secondsPassed = SecondsFromTime(OpenTime);
def rth = ((RegularTradingEnd(GetYYYYMMDD()) - (RegularTradingStart(GetYYYYMMDD()))) / (AggregationPeriod.WEEK));

plot Price = if secondsPassed >= 0 and secondsPassed <= durationSec and GetDayOfWeek(GetYYYYMMDD()) == 5 then close else Double.NaN;
 
Last edited:

Gellidus

Member
VIP
I would like to ask about the timezone. Do I set 0930 or 1030 because fo daylight savings? Or do I change to my timezone coz I am in Asia to set it to 2230 instead?
 

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.
Top