Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleOnOrderUpdate

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

    SampleOnOrderUpdate

    The following is a scrap of code from the OnExecution method.

    // Resets the entryOrder object to null after the order has been filled or partially filled.
    if (execution.Order.OrderState != OrderState.PartFilled)
    {
    entryOrder = null;
    }

    The comment does not seem to match the conditional logic.

    In any event it seems to me that this conditional could never become true since it is contained within another conditional that has 'execution.Order.OrderState == OrderState.PartFilled' OR'd with other contitions.

    Am I missing something?

    #2
    DaveS,

    It works as intended as is. The overarching if-statement has many possible OrderStates. You want to reset the entryOrder to null on all OrderStates except the PartFilled one.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Yes, sorry, I misread the outer 'if' and that lead to a wrong expectation for the inner one - doh!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      656 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      371 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      579 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X