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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      56 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X