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.
          https://ninjatrader.com/support/help...rderupdate.htm
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by lucentcbdnews, Today, 12:30 AM
          0 responses
          1 view
          0 likes
          Last Post lucentcbdnews  
          Started by lucentcbdnews, Today, 12:29 AM
          0 responses
          2 views
          0 likes
          Last Post lucentcbdnews  
          Started by SmartArtsStudio, Yesterday, 11:24 PM
          0 responses
          3 views
          0 likes
          Last Post SmartArtsStudio  
          Started by kenz987, Yesterday, 10:06 PM
          0 responses
          3 views
          0 likes
          Last Post kenz987
          by kenz987
           
          Started by AaronKoRn, Yesterday, 07:24 PM
          0 responses
          8 views
          0 likes
          Last Post AaronKoRn  
          Working...
          X