Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 andrewtrades, Today, 04:57 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      6 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      9 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      20 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X