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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X