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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        47 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X