Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder Query

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

    IOrder Query

    Hi Support,

    a.
    can the IOrder type SubmitOrder() be used in the Advanced Managed Approach environment or does it only work in an Unmanaged environment?

    b.
    if the later is true, is there a way to handle OCO orders in the Advanced Managed Approach (e.i. having simultaneously a EnterStopLong() and EnterStopShort())?

    kind regards,

    #2
    bendjo, welcome to our forums - SubmitOrder would be only for the Unmanaged mode.

    OCO in the managed approach would need to be done via custom coding, by for example monitoring price and then cancelling the nonneeded order via a CancelOrder() call and submitting the new order in. Having both parts resting would not be allowed by our internal order handling rules, to see those disabled please work in the unmanaged mode for ultimate flexibility.

    Comment


      #3
      Bertrand, I never used the unmanaged approach, but I would guess it only defers in the way it handles order. Would something like this work as an OCO order to go Short OR Long?

      Code:
      private IOrder entryOrderLong = null;
      private IOrder entryOrderShort = null;
       
      protected override void OnBarUpdate()
      {
      if(BarsInProgress == 1)
      {
         // Entry condition
         if (Closes[0][0] > SMA(BarsArray[0],20)[0] && entryOrderLong == null && entryOrderShort == null)
         {
            entryOrderLong = SubmitOrder(1, OrderAction.Buy, OrderType.Stop, 1, 0, Highs[0][0], "Oco", "Long");
            entryOrderShort = SubmitOrder(1, OrderAction.Sell, OrderType.Stop, 1, 0, SMA(BarsArray[0],20)[0], "Oco", "Short");
         }
      }

      Originally posted by NinjaTrader_Bertrand View Post
      bendjo, welcome to our forums - SubmitOrder would be only for the Unmanaged mode.

      OCO in the managed approach would need to be done via custom coding, by for example monitoring price and then cancelling the nonneeded order via a CancelOrder() call and submitting the new order in. Having both parts resting would not be allowed by our internal order handling rules, to see those disabled please work in the unmanaged mode for ultimate flexibility.

      Comment


        #4
        Correct, that's how you would link the together. If one fills, the other will be cancelled then without needing a specific CancelOrder call to the IOrder.

        Comment


          #5
          Bertrand, given there is no LiveUntilCancelled field I assume any order in unmanaged approach is live until cancelled, is this right?

          If this is the case, for OCO orders would it be sufficient cancelling only 1 order, or would I need to cancel both orders? and if the later is true would something like this work?
          Code:
              // If it's 6.00PM cancel all orders
              if (Times[1][0] == 180000)
          {
                   CancelOrder(entryOrderLong);
                   CancelOrder(entryOrderShort);
          }
          Originally posted by NinjaTrader_Bertrand View Post
          Correct, that's how you would link the together. If one fills, the other will be cancelled then without needing a specific CancelOrder call to the IOrder.

          Comment


            #6
            Correct, unmanaged orders are liveUntilCancelled per default. Cancelling one leg should be sufficient for the OCO to kick in and thus cancel all your orders.

            Comment


              #7
              Many thanks for your assistance.

              What about stoploss handling, I assume I would need to enter stops always using the type SubmitOrder(). If the latter is true, how can I then trail a stop loss (update the stop)? would a new order with the same signal name be sufficient or would I first need to cancel the existing stop loss order?

              Originally posted by NinjaTrader_Bertrand View Post
              Correct, unmanaged orders are liveUntilCancelled per default. Cancelling one leg should be sufficient for the OCO to kick in and thus cancel all your orders.

              Comment


                #8
                Correct, just update the stop by using ChangeOrder - there's no Set() methods here available so it would be a custom solution as far as trailing goes.

                Comment


                  #9
                  Bertrand, this is very clear. To conclude am I right in thinking that all other methods used in advanced managed approach, such as onExecution() and onOrderUpdate() work also in Unmanaged approach?

                  Originally posted by NinjaTrader_Bertrand View Post
                  Correct, just update the stop by using ChangeOrder - there's no Set() methods here available so it would be a custom solution as far as trailing goes.

                  http://www.ninjatrader.com/support/h...ub=ChangeOrder

                  Comment


                    #10
                    Yes, they would be available as well for advanced handling in unmanaged.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    648 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    369 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    108 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    572 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X