This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Obtain next valid order identification number


id = orderid(ib)



id = orderid(ib) obtains the next valid order identification number for Interactive Brokers® connection ib.


collapse all

Create an IB Trader Workstation℠ connection on the local machine using port number 7496.

ib = ibtws('',7496);

Obtain the next valid order identification number using ib.

id = orderid(ib)
id =


id contains the next valid order identification number. To create an order, use this number in createOrder.

Close the IB Trader Workstation℠ connection.


Input Arguments

collapse all

IB Trader Workstation connection, specified as an IB Trader Workstation connection object created using ibtws.

Output Arguments

collapse all

Next valid order identification number, returned as a numeric scalar.


If the variable ibBuiltInErrMsg appears in the MATLAB® workspace, check the status of the connection and function execution by displaying the contents of this variable. ibBuiltInErrMsg contains messages related to:

  • Connection

  • Information resulting from executing functions

  • Errors

Introduced in R2015a