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

GetNextBeginEnd

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

    GetNextBeginEnd

    Hi,

    I am printing the values of next begin and End Date Time. and they does not match with Begin & End of the chart loaded. I am using the <Use instrument settings> session template in the chart.

    The begin and end of the chart are: 08:00 and 19:00

    But, the begin and end returned by the GetNextBeginEnd are: 07:00 and 21:00.

    Which is the righ way to get the correct begin & end throght the GetNextBeginEnd funtion?.

    I am using the code in the help guide:

    { // On the start of a new session, get the next begin or end session time and its corresponding paired session begin/end time.
    if (Bars.FirstBarOfSession)
    Bars.Session.GetNextBeginEnd(BarsArray[0], 0, out sessionBegin, out sessionEnd);

    Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd);
    }


    Thanks

    #2
    Hi CJS,

    Time is used differently here so there will be some differences.

    The time on a chart represents when a bar ends. The time in the session template is when that template starts.

    You should expect that that GetNextBeginEnd() returns times in line with the session template defined. The time will be offset by any differences between your local time zone settings, and the time zone setting for the session template applied.

    What are the details of this test?
    Instrument, chart interval.
    Your local time zone.
    What is the exact session template used? Check this in the instrument manager for the instrument you're checking.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      I'm running into this problem too.

      For me, I'm in Arizona and this GetNextBeingEnd time was working before the day light savings time change. Now its off an hour and I can't find anything to explain it.

      (And of course we in Arizona don't shift due to Day Light Saving time.)

      The specific example is using the Euro (6E). The session template is the CME FX Futures ETH.
      That session template uses US Central Time.

      The weird part is the chat is working correctly, but my script to display text on the screen of the start and stop times is off by an hour. The script uses the GenNextBeginEnd time function.

      I know about PC clock sync and do this often cause i found a problem where my clock was using a bad reference to update and had gotten off. Of course if the data and the chart are working, the PC clock has to be synchronized.


      I just don't understand.

      Help!

      Regards,
      taddypole...

      Comment


        #4
        Hi Taddypole,

        Please make sure you have all critical Windows updates downloaded. There are updates related to daylights savings time changes that you will need for all the .net date/time items to work correctly.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Taddypole View Post
          Hello,

          I'm running into this problem too.

          For me, I'm in Arizona and this GetNextBeingEnd time was working before the day light savings time change. Now its off an hour and I can't find anything to explain it.

          (And of course we in Arizona don't shift due to Day Light Saving time.)

          The specific example is using the Euro (6E). The session template is the CME FX Futures ETH.
          That session template uses US Central Time.

          The weird part is the chat is working correctly, but my script to display text on the screen of the start and stop times is off by an hour. The script uses the GenNextBeginEnd time function.

          I know about PC clock sync and do this often cause i found a problem where my clock was using a bad reference to update and had gotten off. Of course if the data and the chart are working, the PC clock has to be synchronized.


          I just don't understand.

          Help!

          Regards,
          taddypole...
          In Windez, what timeZone do you have set? Are you sure that you have it set to "Arizona" rather than one of the standard time zones (I believe "Pacific" would be the one to confuse in Arizona).

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by philmg, Today, 01:17 PM
          0 responses
          2 views
          0 likes
          Last Post philmg
          by philmg
           
          Started by cre8able, Today, 01:01 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by manitshah915, Today, 12:59 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by ursavent, Today, 12:54 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by Mizzouman1, Today, 07:35 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X