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());

    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.

        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);

            Comment


              #7
              Thank you Paul.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              85 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              47 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              29 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              32 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              67 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X