NexusFi: Find Your Edge


Home Menu

 





Current Time CME


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one mk77ch with 3 posts (0 thanks)
    2. looks_two sam028 with 2 posts (5 thanks)
    3. looks_3 decs0057 with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,295 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 162 since Oct 2010
Thanks Given: 30
Thanks Received: 428

Hello,

Im trying to create a little indicator which displays the current time for the e-mini session.
if im right, this would be the time of chicago, the central time zone.

Could anybody tell me how i get this current time?

thank you,
mike

Update:

got it

DateTime UTCLocal = DateTime.Now.ToUniversalTime().AddHours(-5);
DrawTextFixed("time",UTCLocal.ToLongTimeString(),TextPosition.BottomLeft);


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Bitcoin’s 2022 low, 2025 high and 2026 low so far arou …
Cryptocurrency
No book, only a stair: journaling fills where price move …
Cryptocurrency
My Rant with AMP Futures
Trading Reviews and Vendors
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
 
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709


Hmm, it's not always -5 hours, 365 days/year, be careful.
You maye use TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time") with TimeZoneInfo.ConvertTime(), to avoid any problems.


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:
  #4 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 162 since Oct 2010
Thanks Given: 30
Thanks Received: 428

hey sam,

thank you very much for your reply.
could you please provide a small sample code how this could be done?

im stuck after the intitla part of the timezone:

TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");

thak you and cheers,
mike


Started this thread Reply With Quote
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709

Not tested:

 
Code
                            
private DateTime now, timeinChicago;

private 
TimeZoneInfo cst;     
protected 
override void Initialize()
{
    
cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
}
protected 
override void OnBarUpdate()
{
    
now = DateTime.Now;
    
timeinChicago = TimeZoneInfo.ConvertTime(now , cst);
    Print(
"Time in Chicago: " + timeinChicago);
} 


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:
  #6 (permalink)
 
mk77ch's Avatar
 mk77ch 
Switzerland
 
Experience: Advanced
Platform: NinjaTrader
Broker: Dorman
Trading: Currency Futures, ES
Posts: 162 since Oct 2010
Thanks Given: 30
Thanks Received: 428

you are the man, it works!

thank you very much,
mike


Started this thread Reply With Quote
  #7 (permalink)
 decs0057 
Munich, Germany
 
Experience: Intermediate
Platform: NinjaTrader, TWS
Broker: IB, NinjaTrader Brokerage
Trading: ES,NQ,6E
Posts: 73 since Feb 2010
Thanks Given: 15
Thanks Received: 25

you can use timezone info from session of Instrument

TimeZoneInfo tzi = Instrument.MasterInstrument.Session.TimeZoneInfo;


Reply With Quote
Thanked by:




Last Updated on May 15, 2013


© 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