Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2nd Instrument in Strategy

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

    2nd Instrument in Strategy

    Hi
    I am having a problem with adding a 2nd Instrument to my strategy. If I add the following code into Initialise() in my strategy, it stops working completely , the backtest just returns immediately.

    // Add Second Symbol
    Add("CL 06-10", BarsPeriod.Id, BarsPeriod.Value);

    If I comment out the line of code above the backtest works fine again.

    Any ideas what is going on here?

    thanks
    Lloyd

    #2
    Hello,

    Did you follow the help guide and references on using a multi series strategy? When you add instruments or time frames you need to also add checks for BarsInProgress in your code. So that your code knows what instument to run on.

    Multiple Time Frames and Instruments:
    <http://www.ninjatrader-support.com/H...struments.html>

    Sample NinjaScript for multi series coding:
    <http://www.ninjatrader-support2.com/...ead.php?t=5787>
    BrettNinjaTrader Product Management

    Comment


      #3
      Also,

      The dynamic way of adding instrument is not supported as BarsPeriod.Id and BarsPeriod.Value do not exist yet in the Init() Method. These will need to be hard coded in.
      BrettNinjaTrader Product Management

      Comment


        #4
        Apologies

        Guys

        Sorry about this one, my problem was I had no historical data in my db for the CL 06-10 contract! Apologies for wasting your time.
        kind regards
        Lloyd

        Comment


          #5
          No Problem.

          Just glad that you got it figured out.
          BrettNinjaTrader Product Management

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          598 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          555 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X