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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X