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 arvidvanstaey, Today, 02:19 PM
      4 responses
      11 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      61 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      9 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      48 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X