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 ttrader23, Today, 04:48 PM
        0 responses
        2 views
        0 likes
        Last Post ttrader23  
        Started by wisdomspoon, Today, 03:50 PM
        3 responses
        14 views
        0 likes
        Last Post rockmanx00  
        Started by Mountain_cast, 02-10-2025, 11:14 PM
        2 responses
        19 views
        0 likes
        Last Post Mountain_cast  
        Started by Robotman, Today, 01:06 PM
        2 responses
        37 views
        0 likes
        Last Post Robotman  
        Started by PH_GMT, Today, 12:40 PM
        4 responses
        19 views
        0 likes
        Last Post PH_GMT
        by PH_GMT
         
        Working...
        X