Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Difference between "order.OrderState" and "Name.OrderState" ?

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

    Difference between "order.OrderState" and "Name.OrderState" ?

    Hello staff,

    I've been browsing through the Help Guide to find some logic examples, and found an interesting difference of approach.

    In this article --> (https://ninjatrader.com/support/help...nt8/?order.htm) the following method is used.

    if (entryOrder != null && entryOrder == order)
    {
    if (order.OrderState == OrderState.Filled)
    entryOrder = null;
    }


    While in this article --> (https://ninjatrader.com/support/help...ancelorder.htm) the following method is used.

    if (myEntryOrder != null && myEntryOrder == order)
    {
    if (myEntryOrder.OrderState == OrderState.Cancelled)
    myEntryOrder = null;
    }


    What is the difference between these two approaches, and is one better over the other?

    I am looking forward to your reply.

    #2
    One order is Filled and the other is cancelled.

    Comment


      #3
      Hello Emma1,

      One example is about Filled, and the other is about Cancelled, but that's not the difference I am talking about.
      If you look at the code in blue, you can see that I have emboldened the different parts I am referring to, and both methods are very functional regardless of whether it's used in a Filled or Cancelled scenario. My question thus remains unanswered.

      Thank you for your input.

      Comment


        #4
        In my opinion, there is no difference between the two, i believe its naming convention.
        from the guide additional comment states :

        ' // Assign entryOrder in OnOrderUpdate() to ensure the assignment occurs when expected.
        // This is more reliable than assigning Order objects in OnBarUpdate, as the assignment is not guaranteed to be complete if it is referenced immediately after submitting'
        Last edited by Emma1; 08-01-2020, 02:42 PM.

        Comment


          #5
          Hello Emma1,

          The 'order' variable is provided from the OnOrderUpdate() override method.
          This should be assigned to a private variable for access later, or from another method.

          The help guide has an example of assigning the order object from OnOrderUpdate() to an Order variable.

          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          25 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          121 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          64 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X