Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A unique Id for order (iorder)

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

    A unique Id for order (iorder)

    Greetings,

    NT Docs has 2 contradictory points:

    1.
    Token
    A string representing the unique id of an order

    2.The property <IOrder>.Token is NOT a unique value since it will change as the strategy transitions from historical to real-time

    The question is: what should be used as order ID, in other words what does the best "orderId" look like?

    Thank you.
    Alex.

    #2
    Hi Alex,

    Token was used previously in NT 6.5. Now the identifier for the order is the IOrder object name. This is defined by you and one popular convention is just using the orders purpose for the name.

    private IOrder entryOrder;
    private IOrder stopOrder;
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      are you saying that if I create orders like this:
      ...
      {
      tag = getSomeUniqueString();
      IOrder order = EnterLongLimit(BarsInProgress, true, 1, limitPrice, tag);
      }

      then all of them will have the same ID?..

      I do not think this is the case. Could you give me a sample code where orders are managed by some unique ID?

      Thanks!

      Comment


        #4
        Unfortunately we do not have such a sample. The sample for working with IOrders and OnExecution() is here:
        The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()


        You work with only instance at a time of the order object, and to reference properties about the order you work with the order object itself.

        Token is the only property that offers a unique value per instance. You can use as long as you understand how it can change when the strategy transitions from historical to real-time.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          1) My question is how to distinguish orders by ID.
          I would like to store some number or string and in any NT event be able to compare this ID to IOrder's ID. So far I do not see such property in IOrder. Token IS NOT ID according to NT documentation (see the first message in the thread).

          2) It has been said by NT rep here in some thread that I can compare IOrder objects themselves. This helps as long as I can use IOrder objects as keys in Dictionary. Please confirm that IOrder objects can be used as keys in Dictionary.

          Thank you.

          Comment


            #6
            1) If the built in properties don't offer what you want, you would have to custom code something. Token seems to fit what you're looking for, but you could also consider building your own orders collection, just storing whatever information you want before "nulling" the order so it's ready for a new instance.

            2) We offer no specific recommendation on this, but you're welcome to try and see if it works for the information you're trying to capture.
            Last edited by NinjaTrader_RyanM1; 01-23-2012, 10:35 AM.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              When someone asks for an ID he/she means an ID Not something that looks like ID but does not work in some boundary cases, like Token

              There is no built-in order ID and there is no way to assign it manually to IOrder with, say, GUID.

              Please forward a unique order ID as a feature request then.

              Comment


                #8
                We wish to thank you for sharing your enhancement ideas with us; your suggestion will be tracked using ID#1446.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                639 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                366 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                107 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                569 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                572 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X