Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnExecutionUpdate parameters

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

    OnExecutionUpdate parameters

    Hi I would like to ask about signature of this method:

    Code:
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    I understand like OnOrderUpdate(...) works
    • it contains Order object = represents the most current state
    • it contains many parameters = that represents information for this callback, if we want process all events sequentially, as they happen. It means Order can contain latest up-to-date information, that is newer, than in following parameters.

    It all makes sense.

    I try, to understand the OnExecutionUpdate(...) the same way, but I cannot understand it:
    Problem is, that I cannot understand the 1st parameter - the Execution object. It does not make sense to me see any order-execution like the most current state, because each one order-execution is individual separate event. These events add together, until whole order quantity is filled. So one order can have one or more multiple executions, until it is fully filled.

    I want to say, that I don't see any logical parallel for first parameter between between these 2 methods. For OnOrderUpdate(...) it makes sense. For OnExecutionUpdate(..) not.

    Can you give me example of situation, where I would need access the first parameter Execution and its internal properties, instead of all following parameters, so I can spot meaning/importance of the first Execution parameter?
    Last edited by misova; 09-07-2016, 07:21 AM.

    #2
    Hello misova,

    The execution object is not the order itself, but an object that contains information about the last execution. (An execution is a fill)

    That execution object will also contain the order that originated that fill.
    execution.Order

    For example if the execution is a part fill, you can check the execution.Quantity (amount filled in this execution) and compare this with the execution.Order.Filled (the amount that has been filled so far for the order) or execution.Order.Quantity (the original quantity the order was submitted for).

    In general, for most stuff you can use either OnExecution or OnOrderUpdate. OnExecution will only trigger when there has been an execution (for example for each part fill). OnOrderUpdate will trigger when the order itself changes order states. For example going from OrderState.Working to OrderState.Filled.


    An example situation is where you are using an unmanaged strategy and you need to update an exit order's quantity as part fills come in.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you ChelseaB,

      I hope I got it.

      I say it in my words:

      The variable thing, that can be "most up to date" in the OnExecutionUpdate(..) is the Order that is sits inside the Execution object i.e. execution.Order.

      It can be used this way, for example:
      When OnExecutionUpdate() is invoked, it contains int quantity parameter, that mean size (contracts) for this one specific execution. We expect more such callbacks, if order is big and probably will not filled at once.

      But there is a chance, that "most up-to-date" overall state of this big Order can be further, than currently processing OnExecutionUpdate(..) callback informs me. And this most up-date-state can be checked (if needed) checking execution.Order. It can happen, that Order is completely Filled already, despite currently processed OnExecutionUpdate(...) callback is informing me just about 1st execution (and other callbacks will follow).

      This is what I needed to understand. It makes sense to me now.
      I hope I understood it correctly.
      Last edited by misova; 09-07-2016, 12:39 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      6 responses
      28 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by gbourque, Today, 06:39 AM
      2 responses
      14 views
      0 likes
      Last Post gbourque  
      Started by rexsole, Today, 08:39 AM
      0 responses
      4 views
      0 likes
      Last Post rexsole
      by rexsole
       
      Started by trilliantrader, Yesterday, 03:01 PM
      3 responses
      31 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by Brevo, Today, 01:45 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X