Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

comparing order objects

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

    comparing order objects

    which is better?
    comparing the order names or the order objects?
    • execution.Order.Name==entryOrderLong.Name
    • execution.Order==entryOrderLong

    #2
    Hello,
    One of these would not be better than the other unless you are specifically needing the name or the order object for some circumstance.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      I am reading the comments in your documentation.
      Are you suggesting that if I assign the orderobject when I submit the order, it will not have a reliable data on it? should I reassign it again in orderupdate?
      entryOrderLong=SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Market, DefaultQuantity, 0, 0, "", "bounceStates.watch4longbounce");
      QUOTE]
      protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
      {
      // 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 gauranteed to be complete if it is referenced immediately after submitting
      if (order.Name == "Enter Long" && orderState == OrderState.Filled)
      entryOrder = order;
      }
      [/QUOTE]

      Comment


        #4
        appreciate an update!!

        Comment


          #5
          Hello,
          Can you clarify what you are meaning by reliable data?
          If you are checking on a fill in OnExecution() or the status of an order in OnOrderUpdate() you will need to have the order assigned in OnExecution() or OnOrderUpdate to ensure that it is when the order or fill is actually active.
          Cody B.NinjaTrader Customer Service

          Comment


            #6
            my concern about reliability is due to your coments in the documentation..., I assign the Order objects in my onBarupdate when I submit the order. I am assuming that the Order object is maintained reliably. Please clarify..,
            protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
            {
            // 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 gauranteed to be complete if it is referenced immediately after submitting
            if (order.Name == "Enter Long" && orderState == OrderState.Filled)
            entryOrder = order;
            }

            Comment


              #7
              Hello,
              If you assign an IOrder to a variable in OnBarUpdate(), you cant directly access it from OnBarUpdate() right after you assign it because it may or may not be null at that time:
              Code:
              IOrder myOrder; 
              
              protected override void OnBarUpdate()
              {
                myOrder = EnterLong();
                Print(myOrder.AvgFillPrice);
              }
              This is not assigned yet.

              Instead, using OnOrderUpdate() you are guaranteed it will be not null or at least be more updated than the prior example.
              Cody B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by yertle, Today, 08:38 AM
              0 responses
              1 view
              0 likes
              Last Post yertle
              by yertle
               
              Started by Mestor, 03-10-2023, 01:50 AM
              15 responses
              378 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by samish18, Yesterday, 08:57 AM
              10 responses
              27 views
              0 likes
              Last Post samish18  
              Started by matty89, 03-02-2020, 08:31 AM
              34 responses
              3,039 views
              1 like
              Last Post NinjaTrader_BrandonH  
              Started by kujista, Today, 05:44 AM
              3 responses
              14 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X