Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access Days to expiry in C#

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

    Access Days to expiry in C#

    What is the best way to access the days to expiry which is visible in the strategy analyzer? Regards and many thanks.

    #2
    Hello elliot5,

    Thanks for your post.

    The rollover dates in the Instrument editor are the only dates associated with an instrument in NinjaTrader.

    The RolloverIndications indicator from the Ecosystem User App Share gets the next contract month and from this, you can get the date. You could copy the code from the RolloverIndications indicator into your coded script, then subtract that date from today's date to see how many days it will be.

    Rollover Indications: https://ninjatraderecosystem.com/use...indications-2/

    Let me know if I may assist further.


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      if(BarsInProgress == 20)
      {
      DaysToExpiry = (Bars.Instrument.MasterInstrument.RolloverCollecti on[20].Date - DateTime.Now.Date);
      }

      The above call does not work - am i looking in the right place?
      Regards and thanks
      Last edited by elliot5; 09-06-2022, 12:46 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X