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 Felix Reichert, 04-26-2024, 02:12 PM
          7 responses
          48 views
          0 likes
          Last Post Felix Reichert  
          Started by Irukandji, Yesterday, 05:50 AM
          2 responses
          8 views
          0 likes
          Last Post Irukandji  
          Started by Creamers, 04-27-2024, 05:32 AM
          10 responses
          66 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by seq2seq, 05-07-2023, 07:26 PM
          7 responses
          566 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by manueldecastro, Today, 10:26 AM
          3 responses
          12 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X