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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        63 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X