Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument.Expiry.Day incorrect

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

    Instrument.Expiry.Day incorrect

    I am trying to get the value for the last trading day of a contact with Instrument.Expiry.Day but it is incorrect, ie for the FGBL 09-2013 it is giving a value of 1 when the expiry was on the 5th? is there an other way to get the expiry day? The Month and Year values are correct.

    Could I use OnTermination() instead of running something on the last trading day if I want to print some values to output at the end of a contract, when does OnTermination get triggered?
    Last edited by GKonheiser; 09-25-2014, 06:20 AM.

    #2
    Hello,

    Thank you for the question.

    When you are trying to get the expiry it returns the correct month and year but as you have noticed you get a 1 for he day when using that statement.

    This is something where you would want to loop through the rollover collection to get the actual rollover day. There is not really any documentation on this as it is unsupported but this may help.

    There is a publicly available indicator that you can view the source of that shows how to do this. Here is a link: http://www.ninjatrader.com/support/f...d=4&linkid=558

    This essentially puts a rollover button in the chart but you could use the code it has in your own scripts if you wanted.

    The section you are looking at in the script is within the for statement looping through the rollover collection.

    Please let me know if I may be of additional assistance,

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    51 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    275 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X