Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

short question about iOrder OrderState

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

    short question about iOrder OrderState

    I came across the following snippet of code:

    if (longEntry != null && longEntry == execution.Order)
    {
    if (execution.Order.OrderState == OrderState.Filled
    || execution.Order.OrderState == OrderState.PartFilled
    || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
    { ... stuff }

    The first two if checks I understand - check if the order was filled or partially filled.

    But what about the third check? The OrderState of an iExecution Order property can be cancelled and still have it have some type of fill? I'm trying to understand how we can get to this point. We are in OnExecution and to be in this block, longEntry == execution.Order - so how can we have canceled the order and still have it reach this point?

    That's my short question - how and why does this happen? If this is really necessary there are probably some other holes in my coding that need plugging. THANKS NINJAS.

    #2
    Hello Locke,

    This snippet of code:
    Code:
    (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0)
    checks if the order was partially filled and then cancelled. The Order.Filled integer returns the quantity filled so far. For example: If the quantity is 1 and the order is cancelled, then the order was partially filled (although it wouldn't have the PartFilled order state).

    For more information on the various order states, please see the IOrder section of the help guide here: http://ninjatrader.com/support/helpG...nt7/iorder.htm

    Please let me know if you have any questions.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Thanks Michael, this is clear now.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pibrew, Today, 06:37 AM
      0 responses
      1 view
      0 likes
      Last Post pibrew
      by pibrew
       
      Started by rbeckmann05, Yesterday, 06:48 PM
      1 response
      14 views
      0 likes
      Last Post bltdavid  
      Started by llanqui, Today, 03:53 AM
      0 responses
      6 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      11 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      15 views
      0 likes
      Last Post AaronKoRn  
      Working...
      X