Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time zone indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time zone indicator

    I want to make sure my PC is set to the time zone my strategy times has coded.
    I want to check on the hour and not the whole date,or minutes or seconds.. Seems like every minute turnover there is a flash its Timezone is wrong,, probably due to milliseconds.
    Any suggests on how just to parse out the hour for checking.


    DateTime local = DateTime.Now;
    DateTime UTCLocal = DateTime.Now.ToUniversalTime().AddHours(-5);//Converts a bars time stamp to Central time, regardless of local time zone.

    if (local != UTCLocal)

    DrawTextFixed("tradetimes","Check Time Zone!!"+"\n"+"NOT CST"+ "\n" + UTCLocal.ToString(),TextPosition.BottomRight,Color .Black,new Font("Arial",10),Color.Black,Color.Yellow,5);

    #2
    Originally posted by gg80108 View Post
    I want to make sure my PC is set to the time zone my strategy times has coded.
    I want to check on the hour and not the whole date,or minutes or seconds.. Seems like every minute turnover there is a flash its Timezone is wrong,, probably due to milliseconds.
    Any suggests on how just to parse out the hour for checking.


    DateTime local = DateTime.Now;
    DateTime UTCLocal = DateTime.Now.ToUniversalTime().AddHours(-5);//Converts a bars time stamp to Central time, regardless of local time zone.

    if (local != UTCLocal)

    DrawTextFixed("tradetimes","Check Time Zone!!"+"\n"+"NOT CST"+ "\n" + UTCLocal.ToString(),TextPosition.BottomRight,Color .Black,new Font("Arial",10),Color.Black,Color.Yellow,5);
    Code:
    if (local.Hour != UTCLocal.Hour)
    ref: http://msdn.microsoft.com/en-us/libr...roperties.aspx

    Comment


      #3
      Hello gg80108,

      If you only want to check the hours you may use the following for an example:

      Code:
      if(local.Hour != UTCLocal.Hour)
      {
        //DO something
      }
      Here is a reference that you may use that goes over how to manipulate DateTime objects.
      http://www.ninjatrader.com/support/f...ad.php?t=19292

      Also you may view the MSDN about DateTime objects as well.
      http://msdn.microsoft.com/en-us/libr....datetime.aspx
      JCNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      345 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X