Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting dynamic list of contract months in backtest

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

    Getting dynamic list of contract months in backtest

    Hi Ninjas,

    I'd like to ask, if is it possible in NT script to get list of contract months defined withing the basket via instrument manager. I mean:
    ZC basket has these contracts defined through instrument mananager:
    ZC 09-12, ZC 12-12, ZC 03-13, ZC 07-12.
    I'd like to get list of these contracts dynamically in NT script.
    I need this for comparing price of actually backtested contract month to the next nearest contract month. I didn't find any ideas on this in NT7 help.
    Any hints?
    Thanks in advance.

    #2
    instrument.txt

    Comment


      #3
      qoheleth, there would be unfortunately no supported NinjaScript method to query those however as Baruch pointed out the Instruments.txt file would hold the info for all contracts we track per default. Further you could check into this script here from our sharing working with the rollover's prorgrammatically - http://www.ninjatrader.com/support/f...d=4&linkid=558

      Comment


        #4
        Instruments.txt

        Hi Bertrand,

        Rollover indicator I found not suitable, since it's only for chat use. I dont know ho to use it inside automated strategy.
        I have question regarding Instruments.txt file:
        In file, I looked for ZS symbol to find out the contract months (@rollover line), but I found out that line contains much more contract months then I defined through Instrument Manager GIU. Now I'm not sure if this file is intented to be synchronized with Instrument Manager or not.
        If yes, do I need to follow some procedure in NT7 GIU to make it synchronized?
        Or in general those things are not synchronized and I have to handle differencies in my script?
        Thanks.
        BR.
        P.

        Comment


          #5
          Hello,

          First please ensure you're running the latest version of NinjaTrader here: http://www.ninjatrader.com/download-registration.php

          Once you've installed this go to tools -> Options -> Data tab -> Reset Instruments

          This should sync the instrument.txt and your list.

          Let me know if I can further assist.
          LanceNinjaTrader Customer Service

          Comment


            #6
            Hi Lance,
            I tried, but didn't help. In @RollOver line I still see contract months that are not defined through Instrument Manager in my basket.
            Any other idea?
            BR.
            P.

            Comment


              #7
              I think I may have misunderstood your original request. The rollover dates you've manually added to a basket will not be stored in this text file. You would have to manually code a work around to recognize the rollover dates in the basket as this information is stored in (MY)Documents\NinjaTrader 7\db\NinjaTrader.sdf

              Let me know if I can further assist.
              LanceNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              74 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              45 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              26 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
              62 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X