Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to calculate Exchange Opening Time?

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

    How to calculate Exchange Opening Time?

    Hi,
    For my strategy I need to know the opening times of all exchanges (NY, Tokyo, Sidney, London).
    So I have those parameters:
    private int NYStart = 830;
    private int TokyoStart = 1800;
    private int SydneyStart = 1800;
    private int LondonStart = 200;

    Its for CST so I also have a parameter for CSTOffsetHours.
    Now I need to change those opening hours depending on different DST (day light saving times).
    So that is how I do it:
    int MonthDay = ToDay(Time[0]) % 10000;
    if (MonthDay > 313 && MonthDay < 1106) TokyoStart -= 100;
    if (!(MonthDay > 403 && MonthDay < 1002)) SydneyStart += 100;
    if (MonthDay > 313 && MonthDay < 2603) TokyoStart -= 100;
    if (MonthDay > 313 && MonthDay < 1106) LondonStart -= 100;
    if (MonthDay > 1030 && MonthDay < 1106) LondonStart += 100;

    Is this correct?

    Baruch

    #2
    Baruch, it looks correct to me - you would need to give it a testrun on historical data to check what values are returned for your local timezone setting then, if you run into issues another approach would be converting everything to UTC - http://msdn.microsoft.com/en-us/libr...v=VS.100).aspx
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,
      My question is not about the syntax, but about the values. Are they correct?

      Baruch
      p.s. I don't see how converting to UTC will help. Does it converts the UK DST when its different from US DST?

      Baruch

      Comment


        #4
        I could unfortunately not comment on your logic, you would need to give it a test run to debug - you could do everything UTC related...also expressing your various start times in it.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand,
          I'll do it.

          Baruch

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by bmartz, 03-12-2024, 06:12 AM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          2 responses
          9 views
          0 likes
          Last Post Aviram Y  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X