Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting GetNextRolloverDate

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

    Getting GetNextRolloverDate

    Hello,

    I try to retrieve the expiry date and convert it to a string, but unfortunately I get an error message:

    Print(Bars.Instrument.MasterInstrument.GetNextRoll overDate.Month.ToString);

    Any ideas why?

    Kind regards
    Gerik

    #2
    Hello Gerik,

    Thanks for your post.

    You would need to provide a complete date/time to the GetNextRollOver(). For example:

    if (CurrentBar == 0)
    Print(Instrument.MasterInstrument.GetNextRolloverD ate(Time[0]).ToString());
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      I believe here is an issue:

      Print("GetNextExpiry(Currentbar): " + Instrument.MasterInstrument.GetNextExpiry(Time[CurrentBar]).ToString() + " GetNextExpiry0: " + Instrument.MasterInstrument.GetNextExpiry(Time[0]).ToString());

      Is showing "GetNextExpiry(Currentbar): 01.06.2020 00:00:00 GetNextExpiry0: 01.06.2020 00:00:00" with ES, but it should show 12-20.

      How can I retrieve 12-20?

      Kind regards
      Gerik

      Comment


        #4
        Hello Gerik,

        Thanks for your reply.

        Did you test my example and does it not provide the next rollover date?

        You are using CurrentBar in the Time[barsAgo] which will use the DateTime of the very first bar in the data series and not the actual current bar. CurrentBar is the systems bar counter and it holds the bar count number.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello Paul,

          your example shows 10.09.2020 00:00:00 using ES.

          I want to get 12-20 which is within the symbol name.

          Kind regards
          Gerik
          Last edited by Gerik; 10-01-2020, 04:15 PM.

          Comment


            #6
            Hello Gerik,

            Thanks for your reply.

            To get the charts instrument name and contract month/year, you can use Print (Bars.Instrument.FullName);
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thank you Paul.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by benmarkal, Yesterday, 12:52 PM
              3 responses
              23 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by helpwanted, Today, 03:06 AM
              1 response
              20 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              11 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              244 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Working...
              X