Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Instrument Strategy - Compiler error

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

    Multi Instrument Strategy - Compiler error

    Hi,

    Question #1:
    How do I get the Bid and Ask for a specific instrument on a multi instrument strategy?

    For example: Let's say we have a strategy with 5 instruments. To get the Bid for one instrument I have:
    GetCurrentBid()[3]

    The compiler gives the following error: "Cannot apply indexing with [] to an expression of type double"

    Question #2:
    Similar to #1, how do I enter a trade on a specific instrument on a multi instrument strategy?
    For example: Let's say we have a strategy with 5 instruments. To get the Bid for one instrument I have:
    EnterLong(Quantity)[3];

    The compiler gives the following error: "Cannot apply indexing with [] to an expression of type NinjaTrader.Cbi.IOrder"

    Thanks

    #2
    Hello futures14,

    Thank you for your post.

    You will place the barsInProgress index in the parentheses, so for the fourth bar series I would use GetCurrentBid(3).

    For the orders you will need to use the correct syntax. So EnterLong would be the following for the fourth bar series: EnterLong(3, Quantity, "");

    Please visit the following link for information on using multiple time frames and instruments in your script: http://www.ninjatrader.com/support/h...nstruments.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Hi,

      Thank you for the reply.

      One last question:

      What would be the maximum number of instruments on one chart that you recommend (without impacting performance)?

      Thanks !

      Comment


        #4
        Hello futures14,

        There would not be a maximum number of instruments that we would recommend for performance, as it is mostly the calculations that you are doing and how often you are calling them that will impact the performance the most.

        For example, you may want to use the Calculate On Bar Close (COBC) = true inside of your strategy so that NinjaTrader is only doing your calculations at the close of a bar.

        Happy to be of any further assistance.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        575 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X