Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

On SampleOnOrderUpdate

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

    On SampleOnOrderUpdate

    Hi NT experts,

    The following two questions are related to how NT cancels orders that are associated with the same signal name.

    In SampleOnOrderUpdate, both stopOrder and targetOrder are reset to "null" if either stop or target order is filled. This is done in OnExecution.

    My understanding is: when targetOrder is filled, the internal logic will cancel the working stopOrder. When resetting "null" to both stopOrder and targetOrder, how does the strategy find the still working stopOrder for the cancellation?

    May be the cencel request is sent after OnOrderUpdate but before OnExecution. But I am not sure that is the case.

    The above question is related to the follwoing situation. In OnOrderUpdate, I use a market order to exit a position once its stopOrder is cancelled.

    If NT sends out stopOrder cancel request due to targetOrder fill after OnExecution, then I speculate my market order to exit a position in OnOrderUpdate will not get triggered, because stopOrder is already reset to null. However, if NT sends out cancel request prior to OnExecution, then stopOrder will not be null. Will I end up an open position post targetOrder fill?

    Regards,

    #2
    binwang2, the strategy identifies those orders through their associated IOrder objects, those are not same for the stop and target.



    As noted in the sample we advise to use OnExecution for monitoring stop and target orders as this ensures the strategy has received the updates orderstates.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      binwang2, the strategy identifies those orders through their associated IOrder objects, those are not same for the stop and target.



      As noted in the sample we advise to use OnExecution for monitoring stop and target orders as this ensures the strategy has received the updates orderstates.
      When an order is cancelled, i think only OnOrderUpdate will be called. OnExecution will not be called. On Execution is only called when an order is filled or partilly filled. Is this understanding correct?

      Comment


        #4
        This is correct binwang2 - http://www.ninjatrader-support.com/H...derUpdate.html

        This would depend on your code structure, in any case it's good to wait for a orderstate change confirmation, instead of just relying on a cancel request.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        601 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        347 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        559 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        558 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X