Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stoploss and Target order filled quantity are not closed properly

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

    Stoploss and Target order filled quantity are not closed properly

    Hi,

    In Playback, I have placed Short order for 10 quantity with signal name "$Short" and all 10 got filled. I placed stop loss order (sstop) and target order(starget) for the same. Stop loss order got filled for 10 quantity. I am expecting target order has to be cancelled for all 10 quantity. But What I observed is, 1 got filled on target and 9 got cancelled. This is not expected right ? What cases it would be like this. There one long position opened due to this. How to handle this ?

    Click image for larger version  Name:	Screenshot 2022-04-24 052945.png Views:	0 Size:	426.2 KB ID:	1198587
    Attached Files

    #2
    Hello nandhumca,

    Where you are expecting an order to be cancelled, this is because you are calling CancelOrder() and supplying the variable with the order assigned from OnOrderUpdate(), is this correct?

    Are you checking the order is not null, and the OrderState is OrderState.Working or OrderState.Accepted before attempting to cancel the order with CancelOrder()?

    If you are not, see the ProfitChaseStopTrailExitOrdersExample_NT8 or ProfitChaseStopTrailUnmanagedExample_NT8 depending on what type of strategy you have created.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have a code to cancel my entry order if it is working or part_filled state and not null. But in the sample I gave, the entry order got filled. When Stop order for that entry is fully filled, the associated target order will be cancelled automatically. But here that didn't happed .

      Comment


        #4
        Hello nandhumca,

        An order that is part filled is extremely hard to cancel because its filling and will likely keep filling until filled.

        The order would have to be part filling extremely slowly to be able to get a cancel order with the correct quantity without the cancellation being rejected.

        I recommend you only try and call CancelOrder() on working orders and not filled or part filled orders.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X