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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      63 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      54 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      61 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      48 views
      0 likes
      Last Post CarlTrading  
      Working...
      X