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 CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          247 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          160 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          165 views
          1 like
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          250 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          201 views
          0 likes
          Last Post CarlTrading  
          Working...
          X