Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to cancel unmanaged OCO orders before it getting filled

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

    How to cancel unmanaged OCO orders before it getting filled

    Hi,

    I have a question regarding unmanaged approach of OCO orders. Basically, within a NinjaScript strategy how can I cancel an OCO bracket without waiting to reach the set profit/stop threshold? say that I just want to stop/delete the OCO completely before it actually triggers the profit target or stop loss.

    I used the cancelOrder() method with one of the OCO orders but although it showed as "cancelled" under the "Orders" tab of NT, the actual position still remains open and trading. I tried this with both playback and live simulation and the behaviour is exactly the same. I cannot find any information on how to cancel OCO orders.

    I´d appreciate any help you can provide me on this.

    Thanks​

    #2
    Hello juartur,

    Thanks for your post.

    Please see the forum thread linked below for information about how to cancel an order when using the Unmanaged Approach for placing orders.

    https://ninjatrader.com/support/foru...39#post1153339

    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon,

      ​Thanks for your reply. Actually, I am also using CancelOrder() method as in that previous post but I have the behaviour I mentioned.

      I have attached the results of the playback where you can see the top OCO bracket is closed but the position still remains as 22 so the trade stays on, which is not what I expected. The same behaviour also happens with the live demo account.

      Any further thoughts?

      Thanks
      Juan
      Attached Files

      Comment


        #4
        Hello juartur,

        Thanks for your note.

        The Control Center Orders tab help guide linked below page stats the 'Remaining' column on the Orders tab of the Control Center will display 'The quantity remaining on a part-filled order'.

        If the order is canceled before a fill occurs for that order, the 'Remaining' tab will display the total order quantity of that order.

        If the order was part-filled, such as a quantity of 10 was submitted and a quantity of 5 were filled, the 'Remaining' column would display 5 since a quantity of 5 was not filled.

        If the order was completely filled, such as a quantity of 10 was submitted and a quantity of 10 are filled, the 'Remaining' column will be 0 since the full order quantity was filled.

        Note that if the order State is Cancelled, the orders were canceled and are no longer active.

        Control Center Orders Tab: https://ninjatrader.com/support/help...ngTheOrdersTab

        Please let me know if I may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Hi Brandon

          If I understand you well if the status of the OCO shows as Cancelled and the remaining quantity is different to zero, then the order should not be active.

          But this is not what I´m seeing, in my example the order is cancelled with the remaining quantity 22 but the position still continues to be active with quantity 22, like if the other end didn´t actually cancel the position. I assume therefore it must be an issue with the broker or NinjaTrader playback, but the issue should not happen when trading in a live system. Is this correct?

          Thanks

          Comment


            #6
            Hello juartur,

            Thanks for your note.

            Say an order is submitted with a quantity of 22. When that order is canceled before it is filled the Orders tab of the control center will show 'Cancelled' in the 'State' column indicating that the specific order was in fact canceled. The 'Remaining' column will display '22' since there was no fill that occurred for that order. This does not mean there is still an active order with a quantity of 22. The 'State' column lets us know what the actual state of the order is.

            In the case seen in the screenshot you shared on post # 3, both the Limit and Stop Market orders are 'Cancelled' and are not active.

            As long as the 'State' column shows that the order state for that specific order is 'Cancelled' then the order is not active. You could confirm by opening a Chart window for the same instrument with Chart Trader enabled and set to the same account. I no orders are seen on the chart, this confirms there are no active orders.

            Let me know if I may assist further.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            628 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            361 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            564 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X