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 bortz, 11-06-2023, 08:04 AM
              47 responses
              1,607 views
              0 likes
              Last Post aligator  
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              9 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              19 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              6 views
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              15 views
              0 likes
              Last Post Javierw.ok  
              Working...
              X