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 Shansen, 08-30-2019, 10:18 PM
          24 responses
          938 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          3 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by rocketman7, Today, 01:00 AM
          0 responses
          2 views
          0 likes
          Last Post rocketman7  
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          27 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Working...
          X