Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Migrating to NT7 - Order questions

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

    Migrating to NT7 - Order questions

    Hi there,

    I'm only now starting to do my migration to NT7. After running very reliably, and nearly hands off, for almost 2 years on NT 6.5... I've been very hesitant to do so. But I'm really forced into it by my execution broker.

    Is there a more recent "code-breaking change" document than Revision 11, from Oct of last year? I have a few general questions about what the document is saying. I'll be testing live of course, but I want to gain a high level understanding first.

    - "IExecution.IOrder property will now reflect the order state at the time of OnExecution()
    meaning it could return values ahead of the currently being processed IExecution."

    I don't know what "ahead of the currently processed" IExecution really means. Is IExecution.IOrder always the most current state I should be looking at?

    And if I want to know the average fill price for the ENTIRE order (assuming multiple executions)... what's the best way of determining that inside OnExecution()? Should I be using IExecution.IOrder.AvgFillPrice?

    - "Do NOT hold onto .Token values since they will change as the strategy goes from
    historical to live"

    Okay... so I should stop using Token. But IOrder objects will *NOT* change as the strategy goes from historical to live, correct?

    Just wondering if anyone else doing full 24/7 automation, has run into any other problems/tips as they migrate to NT7?

    #2
    Hi,

    I think maybe this thread should be moved into the NinjaScript forum...

    In any case, just had a question about this as well:

    "If you are relying on the OnOrderUpdate() method to trigger actions such as the submission of a stop loss order when your entry order is filled ALWAYS reference the properties on the IOrder object passed into the OnOrderUpdate() method."

    Just so I understand this correctly... the IOrder passed in will == the IOrder that I retained earlier, but they are NOT actually the same object? They might actually have different properties, correct? I find this extremely unintuitive behavior.

    Comment


      #3
      heech,

      1. For instance, if your order is filled in 3 executions very quickly, you could be processing the 1st partial fill execution but since the order has already filled the IOrder of the IExecution would be in a Filled state instead of a PartFilled state even though we are still just processing the 1st of the partial fills.

      2. AvgFillPrice is fine.

      3. I wouldn't go as far as saying it would never change per se, but all the ducks will still be aligned in a row if you do your equality checks based off of comparisons to IOrders directly. Only this comparison would ensure no issues going from historical to live. This is by far much easier than trying to hold onto .Token IDs. Just have your IOrder object and that is all you need for your checks throughout the lifetime of your strategy.

      4. It simply means use order.OrderState or something like order.Quantity, etc. like how demonstrated in the example in the Help Guide. This is not something new to NT7 and has also been the case in NT6.5.

      Hope that helps.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Josh View Post
        heech,

        1. For instance, if your order is filled in 3 executions very quickly, you could be processing the 1st partial fill execution but since the order has already filled the IOrder of the IExecution would be in a Filled state instead of a PartFilled state even though we are still just processing the 1st of the partial fills.
        Perfect, thank you for the clear explanation. I thought the document was talking about the IOrder object here, versus a reference to a different IOrder object.

        4. It simply means use order.OrderState or something like order.Quantity, etc. like how demonstrated in the example in the Help Guide. This is not something new to NT7 and has also been the case in NT6.5.
        I'm not sure I understand what you're saying. You seem to be saying, I have to reference the properties (like orderstate and quantity) as opposed to... something else? What?

        I thought it was saying I should be careful to distinguish between the IOrder reference passed into OnOrderUpdate() rather than the IOrder reference retained from the exit/enter call.

        Comment


          #5
          Code:
          protected override  void OnOrderUpdate(IOrder order)
          {
              if (entryOrder != null &&  entryOrder == order)
              {
                   Print(order.ToString());
                  if (order.OrderState == OrderState.Cancelled)
                   {
                         // Do something here
                        entryOrder = null;
                   }
               }
          }
          What it refers to is using order.OrderState like in the example above instead of doing something like using your own stored variables that may contain such states in your order state checks when in OnOrderUpdate(). Might make more sense on things like Quantity property for instance. If you had your own variable storing quantity, don't use that variable and instead just use order.Quantity.

          Note: I edited my response with corrected information.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          666 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          377 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          110 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          580 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X