Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order.OrderId use for matching Execution to Order

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

    Order.OrderId use for matching Execution to Order

    Hello

    I need to use the Unmanaged option for my strategy.
    Could anybody confirm that the orderId that I get when I call submitOrder() is the same as the orderID i get in execution.Order.OrderId in OnExecution() ?

    Thanks
    Michael

    #2
    Hi Michael, generally you could not rely on the uniqueness of the order id, since for example brokerages could change it externally, with NT7 IOrder objects could be directly compared for equality now.

    This has been also discussed here - http://www.ninjatrader.com/support/f...ad.php?t=24666

    Comment


      #3
      So the best way to match a entryOrder to its execution in onExecution() is

      execution.Order.Equals(entryOrder)?

      I just tried it in code and doesnt seem to work in sim101.

      Thanks
      Michael

      Comment


        #4
        Correct, for example these both I would expect to get hit the same in OnExecution() -

        protected override void OnExecution(IExecution execution)
        {
        if (entry1 != null && entry1 == execution.Order)
        Print("1: " + execution.Order.OrderId.ToString());

        if (entry1 != null && execution.Order.Equals(entry1))
        Print("2: " + execution.Order.OrderId.ToString());
        }

        Comment


          #5
          what i do is this:

          entryOrder = submitOrder();

          later in onExecution():
          if (execution.Order != null && execution.Order==entryOrder)
          // horray found my order again

          In my environment the matching with order.orderId works better then the .Equals() when I use the Optimiser, I didnt test it using the broker.

          Is there a good example on unmanaged code with order execution matching in onExecution() ?

          Thanks
          Michael

          Comment


            #6
            Hi Michael, there would be no direct Unmanaged sample, however we did publish a system trading the Camarilla Levels which would be also available in an unmanaged version here - http://www.ninjatrader.com/support/f...d=5&linkid=571

            You could review it to get started in this area.

            Comment


              #7
              Thank you for the example.
              It seams that the way i do it using orderId works better in the optimiser than .equals().
              Would you know if the Camarilla code runs in the optimiser and broker accounts alike?

              Thanks
              Michael

              Comment


                #8
                Hi Michael, could not speak for actual trading this strategy, it's not a live traded system but shown for educational purposes only by us how such an approach could be implemented.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                81 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                47 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                29 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                32 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                66 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X