Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multiple product order

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

    multiple product order

    Hi,

    how can I place order on 3 different products at the same time?

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Add("xxx", PeriodType.Second,y, MarketDataType.Last);
    Add("xxxxxxx", PeriodType.Second,y, MarketDataType.Last);
    Add("xxxxxxx", PeriodType.Second,y, MarketDataType.Last);
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // if (CurrentBar < 1 ) return;


    if (CrossAbove(xx(100,0),0.001,2))
    {
    if (BarsInProgress == 1)
    EnterLong(1,"x Trade");
    if (BarsInProgress == 2 )
    EnterLong(1,"x Trade");
    if ( BarsInProgress == 3 )
    EnterShort(1,"xTrade");
    }



    But only 2 out of three products get orders, and they change. Sometimes 1 and 2, sometimes 1 and 3 ...

    What can be the problem here?

    thanks

    Mike

    #2
    Hello Mike,

    Thank you for your post.

    Try using the syntax for EnterLong() that includes the BarsInProgress index:
    Code:
    EnterLong(int barsInProgressIndex, int quantity, string signalName)
    Please let me know if this resolves the matter.

    Comment


      #3
      and with Exit(..)?

      Comment


        #4
        Hello Mike,

        Thank you for your response.
        Code:
        ExitLong(int barsInProgressIndex, int quantity, string signalName, string fromEntrySignal)
        For information on the different order methods please visit the following link: http://www.ninjatrader.com/support/h...er_methods.htm

        Comment


          #5
          BarInProgress 1 and 3 works now, 2 not.

          Is it possible that EnterLong(1,...) followed by a EnterLong(2,...) gives this error? because the 3rd one (EnterShort) does work

          Comment


            #6
            Hello Mike,

            Thank you for your response.

            Are the orders submitted but not filled? Do you see the orders on the Orders tab of the NinjaTrader Control Center?

            I look forward to your response.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            110 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            59 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            37 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            41 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            78 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X