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 bortz, 11-06-2023, 08:04 AM
            47 responses
            1,601 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X