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

Clarification on Entering Stop Orders via ExecutionUpdate / OrderUpdate

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

    Clarification on Entering Stop Orders via ExecutionUpdate / OrderUpdate

    Hey there.

    I've got unexpected behavior related to Market orders on the Unmanaged Order API. I was previously holding a reference to the order object and checking for OrderUpdate or ExecutionUpdate. This no longer works for market orders and I note that the docs have been updated and now say:
    - If you are relying on the OnExecutionUpdate() method to trigger actions such as the submission of a stop loss order when your entry order is filled, ALWAYS reference the properties on the Order object property attached to the Execution object passed into the OnExecutionUpdate() method.

    - If you are relying on the OnOrderUpdate() method to trigger actions such as the submission of a stop loss order when your entry order is filled ALWAYS reference the properties on the Order object passed into the OnOrderUpdate() method.
    To say the least this is vague. "Always reference the properties on the Order Object"

    Which properties?? Furthermore, all the examples provided for this do not adhere to these new rules. Are these going to be updated?

    The only Properties I can use at the moment are OCO ID and SignalID - neither of which are intended to be used for Uniquely identifying an order; The signal field doesn't even enforce uniqueness and is intended to be a human readable description, not an Identifier.

    What is the recommended approach to uniquely identifying an order?

    #2
    Hello reach4thelasers,

    The properties on an order Object are listed at the following link under Methods and Properties, for example LimitPrice or Name.


    An example of a recommended approach to uniquely identifying an order would be the following from within OnOrderUpdate,

    Code:
    if (order.Name == "myEntryOrder")
          entryOrder = order;
    Where order.Name would refer to the signal name of the entry order.

    If you had suggestions for how the helpguide could be improved, or could cite the examples you mention don't abide by the rules, that would be helpful. Or if you'd like to sample of the code you're having issues with, please do so.

    Please let us know if need further assistance.
    Last edited by NinjaTrader_AlanP; 06-14-2017, 01:44 PM.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi All,

      Following this theme, how would you reference the entry order if you setup bracket orders as your entry orders? One of the bracket orders will be filled and the other order will be cancelled (OCO orders). When you write your:

      if (order.Name == "myEntryOrder")
      entryOrder = order;
      statement, how does the system know that "order" is the filled order and not the cancelled order? Or is there another way to handle OCO orders in the OnOrderUpdate / OnExecutionUpdate methods?

      All help is appreciated!

      Comment


        #4
        Hello GeoOrtiz,

        The following if statement will check that both the name = myEntryOrder and that the state of that order is in OrderState.Filled.

        Code:
        if(order.Name =="myEntryOrder"  && order.OrderState == OrderState.Filled)
        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Thank you Alan! That did the trick!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by nandhumca, Today, 03:41 PM
          0 responses
          4 views
          0 likes
          Last Post nandhumca  
          Started by The_Sec, Today, 03:37 PM
          0 responses
          3 views
          0 likes
          Last Post The_Sec
          by The_Sec
           
          Started by GwFutures1988, Today, 02:48 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          6 responses
          33 views
          0 likes
          Last Post ScottWalsh  
          Started by frankthearm, Today, 09:08 AM
          10 responses
          36 views
          0 likes
          Last Post frankthearm  
          Working...
          X