Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by suroot, 04-10-2017, 02:18 AM
        4 responses
        3,019 views
        0 likes
        Last Post truepenny  
        Started by Stanfillirenfro, Today, 07:23 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        2 responses
        22 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by olisav57, Yesterday, 07:39 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by cocoescala, 10-12-2018, 11:02 PM
        7 responses
        944 views
        0 likes
        Last Post Jquiroz1975  
        Working...
        X