Create OTO orders

You can create two or more entry orders and then join them into OTO (one-triggers-others) using just one call.

The first of the orders specified is a root order of the OTO groups. This is the only order which becomes active immediately. All other orders are inactive until the root order is executed.

To create an OTO order group:

1) Create a valuemap and fill only one field:

Valuemap field

Datatype

Description

Command

string

The command. Must be CreateOTO.

The field is obligatory.

2) Create a valuemap for each entry order you want to create and fill it as for the regular entry order.

3) Append each entry order valuemap to the main valuemap using valuemap.append() method. Always append the root order first. Instead of any of depending order you can also create another "CreateOTO" command. In that case the root order of this additional OTO will become a dependent order of the root OTO, so, you can create a tree of OTO orders of any level of hierarchy.

4) Pass main valuemap table to terminal:execute() method.

Limitations:

1) Only entry orders or other OTO groups can be joined into OTO. However, Entry orders with attached stop limits, either regular or ELS can be joined into OTO.

2) All entry orders must be create for the same account.

Returns:

The terminal:execute() method will return the list of request id for each entry order created. So, if 3 entry order is created - 3 request id separated by commas (,) will be returned. Moreover, if any of the orders is ELS order, 3 request id will be returned per each ELS order inside the OTO.

back