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 Brevo, Today, 01:45 AM
            0 responses
            6 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            241 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            6 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X