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 2,803 views
    2. thumb_up 10 thanks given
    3. group 4 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

Timezone Conversion

  #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,335

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
The following user says Thank You to MWinfrey for this post:

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
55 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
29 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,322 since Jun 2009
Thanks Given: 33,143
Thanks Received: 101,477


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 Twitter Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
  #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,335


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
The following user says Thank You to MWinfrey for this post:
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

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
The following 5 users say Thank You to Fat Tails for this post:
  #6 (permalink)
 johnvn 
Cape Town, South Africa
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 7 since Apr 2014
Thanks Given: 8
Thanks Received: 1

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, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


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: 7 since Apr 2014
Thanks Given: 8
Thanks Received: 1

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, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


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
The following user says Thank You to Fat Tails for this post:
  #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,322 since Jun 2009
Thanks Given: 33,143
Thanks Received: 101,477


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 Twitter Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:





Last Updated on May 22, 2014


© 2024 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 - Privacy Policy - Downloads - Top
no new posts