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
    BertrandNinjaTrader Customer Service

    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());
        }
        BertrandNinjaTrader Customer Service

        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.
            BertrandNinjaTrader Customer Service

            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.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Waxavi, Today, 02:10 AM
                0 responses
                3 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                9 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by elirion, Today, 01:36 AM
                0 responses
                4 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by gentlebenthebear, Today, 01:30 AM
                0 responses
                4 views
                0 likes
                Last Post gentlebenthebear  
                Working...
                X