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 Max238, Today, 01:28 AM
          2 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by Shansen, 08-30-2019, 10:18 PM
          25 responses
          949 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          8 responses
          41 views
          0 likes
          Last Post JonesJoker  
          Started by timko, Today, 06:45 AM
          0 responses
          5 views
          0 likes
          Last Post timko
          by timko
           
          Started by Waxavi, 04-19-2024, 02:10 AM
          2 responses
          40 views
          0 likes
          Last Post poeds
          by poeds
           
          Working...
          X