NexusFi: Find Your Edge


Home Menu

 





Timezone Conversion


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 3 posts (6 thanks)
    2. looks_two Big Mike with 2 posts (2 thanks)
    3. looks_3 johnvn with 2 posts (0 thanks)
    4. looks_4 MWinfrey with 2 posts (2 thanks)
    1. trending_up 3,610 views
    2. thumb_up 10 thanks given
    3. group 4 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,336

I remember someone providing code that checked the timezone of the computer and converting the session times in a strategy to another timezone. Does anyone have code examples to do this? I could probably eventually figure out how to do this but would be nice if someone could save some of my braincells. I only have a few left and would like to save those for something else I want to waste them on.


Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
CME Lists U.S. Election Event Contracts as 2028 Democrat …
Prediction Markets & Event Contracts
Iran Ceasefire Surges to 19.5% on US 15-Point Plan -- 82 …
Prediction Markets & Event Contracts
The 50/50 Paradox: Peace and Invasion Each at 20% -- Ira …
Prediction Markets & Event Contracts
BofA Projects $1.1 Trillion in Sports Event Contracts -- …
Prediction Markets & Event Contracts
Cboe Files for Near 24x5 Equities Trading -- December 20 …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
7 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Algo automated / semi-automated trading anyone?
6 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


Try

 
Code
DateTimeOffset newTime = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
It should at least get you started, this is converting from UTC to local but you can do a search on DateTimeOffset and TimeZoneInfo and find other snippets.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,336


Big Mike View Post
Try

 
Code
DateTimeOffset newTime = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
It should at least get you started, this is converting from UTC to local but you can do a search on DateTimeOffset and TimeZoneInfo and find other snippets.

Mike

Thanks Mike...that is a big head start.


Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114

Converting time from your local time to exchange time (as specified by the session template)


 
Code
exchangeTime = TimeZoneInfo.ConvertTime(localTime, TimeZoneInfo.Local, Bars.Session.TimeZoneInfo);

and back

 
Code
localTime = TimeZoneInfo.ConvertTime(exchangeTime, Bars.Session.TimeZoneInfo. TimeZoneInfo.Local);


Reply With Quote
  #6 (permalink)
 johnvn 
Cape Town, South Africa
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 8 since Apr 2014
Thanks Given: 9
Thanks Received: 8

This is just what I was looking for but as a newbie how to I run that code in NT ??



Reply With Quote
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


johnvn View Post
This is just what I was looking for but as a newbie how to I run that code in NT ??




What exactly do you try to achieve?


Reply With Quote
  #8 (permalink)
 johnvn 
Cape Town, South Africa
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 8 since Apr 2014
Thanks Given: 9
Thanks Received: 8

I am trading from South Africa so I am 6 hours ahead of EST. But all the news and charts and info I get is obviously in EST.

The one solution would be to change my PC clock to EST but that messes me around with all my other work.

So an elegant solution would be for the time at the bottom of the chart to be off set by 6 hours to match up with EST.

In the absence of this the clock indicator set to EST would be a nice alternative.

Regards

John


Reply With Quote
  #9 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


johnvn View Post
I am trading from South Africa so I am 6 hours ahead of EST. But all the news and charts and info I get is obviously in EST.

The one solution would be to change my PC clock to EST but that messes me around with all my other work.

So an elegant solution would be for the time at the bottom of the chart to be off set by 6 hours to match up with EST.

In the absence of this the clock indicator set to EST would be a nice alternative.

Regards

John


NinjaTrader always displays charts in local time (time as set per PC clock). You can use a session template or an indicator to plot a vertical line at the market open. You can also select one color for the regular session and another color for the night session. This would give you an idea what is happening.


Reply With Quote
Thanked by:
  #10 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


Hopefully NT8 allows exchange time for charting.

Sent from my LG Optimus G Pro




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on May 22, 2014


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts