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 RookieTrader, Today, 09:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by kulwinder73, Today, 10:31 AM
          0 responses
          5 views
          0 likes
          Last Post kulwinder73  
          Started by terofs, Yesterday, 04:18 PM
          1 response
          23 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          7 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Working...
          X