Try TT Now

ADL®

Order Block

The Order Block will submit a buy or sell order to the exchange as a Limit or a Market Order. The order type can be specified through a drop-down menu accessed by double-clicking on the block. Depending on the order type selected, the user must specify a varying set of inputs:

 
Recommended Tutorials For This Section

For a tactile learning experience, please try the following tutorial:

  • Order Block

Operations

1. Limit Order

  • Instrument, Price, and Quantity inputs are required; the Order Block will submit a buy or sell Limit order for the specified instrument at the input price with an order quantity
  • The following inputs are optional and the corresponding input ports may be exposed by using the double-click Edit Window (see Double-Click Edit Window below for more information)

    • Stop Trigger: When this input is provided, the Order Block will submit a Limit Order with an exchange-recognized Stop Trigger tag. For a Stop Trigger to be valid, the following conditions must be met:

      1. When the Order Block is set to submit BUY orders, the Stop Trigger price must be greater than the last traded price of the instrument specified by ; for SELL orders, the Stop Trigger must be less than the last traded price.
      2. When the Order Block is set to submit BUY orders, the input must be greater than or equal to the Stop Trigger; for SELL orders, the inputs must be less than or equal to the Stop Trigger.
    • Disclosed Quantity: When this input is provided, the Order Block will submit a Limit Order with an exchange-recognized Disclosed Quantity tag. Upon approval, the exchange will acknowledge the total order quantity as , but disclose only the specified amount at a time. If Disclosed Quantity is greater than , exchange will acknowledge as the total order quantity.
    • : When this True/False input is provided, the Order Block will delete the working order when the input value changes from TRUE to FALSE. The Order Block will add a new order when the value changes from FALSE to TRUE.

2. Market Order

Note: When the user selects Market order as the Order Type (through double-click Edit Window), Price input port will be de-exposed automatically. If the port was connected with an edge, the user will be prompted to remove the edge first, and then re-select Market order as the Order Type.

  • Instrument and Quantity inputs are required and Price input cannot be provided; the Order Block will submit a buy or sell Market order for the specified instrument with an order quantity
  • The following inputs are optional and the corresponding input ports may be exposed by using the double-click Edit Window (see Double-Click Edit Window below for more information)

    • Stop Trigger: When this input is provided, the Order Block will submit a Market Order with an exchange-recognized Stop Trigger tag. Market order with Stop Triggers will adhere to the following conditions:

      1. When the Order Block is set to submit BUY orders, the Stop Trigger price must be greater than the last traded price of the instrument specified by ; for SELL orders, the Stop Trigger must be less than the last traded price.
      2. When the Stop is triggered, the exchange will submit a Market order with an order quantity .
    • On/Off: When this True/False input is provided, the Order Block will submit the Market order only if the input value is TRUE. If the input value is FALSE, the Order Block will suspend order submission until the value turns to TRUE. This input can be used to control the timing of the Market order submission.
  • Note: Market orders cannot be submitted with a Disclosed Quantity input

Note: The use of disclosed quantities is currently unavailable when running an algo in simulation mode. See Trading in Simulation Mode within the X_TRADER online help for more information on running algos in simulation.

View: Details

Details
  • The block “remembers” the number of fills it has achieved, and outputs the working quantity according to the following formula:

    • = - [No. of fills achieved]
    • However, if the order was submitted with a Disclosed Quantity, will be equal or less than the Disclosed Quantity.
  • When the current working Limit order or a Market order is executed, a discrete event message is generated from the Fills Output.
  • If the user manually deletes or modifies an order generated by the Order Block, it will relinquish control over to the user, but a discrete event message will still be generated upon order executions. To be specific, the Order Block will ignore left-side inputs, but still generate values from the right-side outputs. If the user pauses and resumes the algorithm, the Order Block will attempt to re-locate its managed order and re-take control. If it cannot locate the order, the Order Block will compare the number of fills it has achieved so far against the user-specified input quantity and submit a new order for the remaining balance, i.e., - [No. of fills achieved]).
  • If you set the Ignore External Modification option, the Order Block will not go dormant when its child order is externally modified (by a user, for example). If the modification was a delete, the Order Block will immediately try to add another child order. If the modification involved a price or quantity change, the Order Block will honor the new price or quantity until one of its input values changes.

View: Double-Click Edit Window

Double-Click Edit Window

Double-click on the block to bring up an edit window:

  • Order Tag: This text box allows the user to tag the orders generated by the Order Block with a custom text which will appear in the “Order Tag” column of the Order Fills Window. By assigning text to each order, you can quickly sort and filter orders on the Order Fills Window by using the Order Tag column.
  • Order Type: Use the drop-down menu to select either "Limit," or "Market."
  • Order Flag Color: The color of the order flag to be displayed within MD Trader. Select white to disable flag color.
  • Order Fields/Inputs: Check/un-check individual inputs to expose/de-expose the corresponding ports on the Order Block. Note, however, that several inputs are automatically exposed or de-exposed depending on the Order Type selected.
  • Order Messages: Check/un-check individual discrete event outputs to expose/de-expose the corresponding discrete event output ports. Using these discrete event output ports allow additional logic to be performed at several key moments during an order's lifecycle. For instance, the user may expose the Add OK port and connect a Value Extractor Block to this port to take a snapshot when the Order Block receives an order add confirmation message from the respective exchange.
  • Options: Check/un-check to enable/disable the following options:

    • Ignore Inputs After Add: When this option is checked, the Order Block will consider its inputs only at the time of an order submission. Once an order is submitted and working, the Order Block will ignore any changes in its inputs. In effect, checking this option instructs the Order Block to submit a "one-shot" order. On the other hand, when this option is unchecked, the Order Block will continue to modify the working order to reflect changes in any of the inputs (note that the inputs can be dynamic):

      • When Input  changes: the block will delete the current working order and then add a new order pertaining to the specified instrument.
      • When Price Input or Quantity Input changes: the block will modify the current working order.
      • When the On/Off Input changes: the block will delete the current working order when the input turns FALSE, and then add a new order when the input reverts to TRUE.
      • When the Stop Trigger or Disclosed Quantity input changes: the block will modify the current working order as long as the specified Stop Trigger or Disclosed Quantity meets the approval conditions (see Operations section above for details on the approval conditions)
    • Auto Resubmit: When this option is checked, the Order Block will re-submit a new order whenever its current working order is deleted. The new order will be submitted with an order quantity of: - [No. of fills achieved]. However, if is FALSE at the time, the Order Block will wait until the reverts to TRUE and then submit a new order. In effect, checking this option instructs the Order Block to submit new orders when necessary in order to ultimately achieve the user specified . When this option is unchecked, however, the Order Block is allowed to submit a single order during the life of the algorithm. Keep in mind that a manual-delete performed by the user will cause the Order Block to will simply relinquish control over to the user regardless of whether this option is checked or not.
    • Leave Orders On Pause: When this option is checked, orders generated by the Order Block remain in the order book even if the algorithm is paused. A paused state can result from a client side connection drop.
    • Leave Orders On Cancel: When this option is checked, orders generated by the Order Block remain in the order book even if the algorithm is canceled. A canceled state can result from a client side connection drop.
    • Ignore External Modification: When this option is checked, the Order Block will not go dormant when its child order is externally modified (by a user, for example). If the modification was a delete, the Order Block will immediately try to add another child order. If the modification involved a price or quantity change, the Order Block will honor the new price or quantity until one of its input values changes.
  • Flip for Sell Orders: Many automated strategies in ADL will have nearly identical buy and sell side routines, with certain blocks acting as "pivot" points. To enable a single algorithm to act either as buy or sell side routine as needed, several blocks in ADL will have the option "Flip For Sell Orders." This option enables them to perform an alternate function depending on the user's selection of the Order Side Variable (either BUY or SELL). The Order Side Variable will appear automatically for any algorithm containing a block with the "Flip For Sell Orders" functionality enabled, and the user must set this variable prior to launching an algorithm. When this functionality is enabled, the Order Block will either submit buy or sell orders depending on the value of the Order Side Variable (see: Flip For Sell Orders Functionality for more information). The user may alter the Order Side variable through one of the following three methods:

    • Using the drop-down menu located at the top portion of the Designer canvas
    • Using the Variables Tab on the Algo Dashboard
    • By using the MD Trader window: Clicking on the bid side column (blue column) will set the Order Side Variable to "BUY," and clicking on the offer side column (red column) will set the Order Side Variable to "SELL." This method applies to Order Ticket Algorithms only (see: Creating and Launching Order Ticket Algorithms for more information).
  • GTC Orders (accessible in Block Properties tab): When this option is enabled, the Order Block will submit GTC (Good 'Till Cancel) orders.

View: Using Single Order Container in conjunction

Using Single Order Container in conjunction

If the Order Block's "Ignore Inputs After Add" option is enabled, it can be used with a Single Order Container. To be specific, the user must expose the Add OK discrete event message output port, and then connect a Single Order Container to the exposed port.

When the Order Block successfully generates an order, the block will output a discrete event message through the Add OK output. If the user feeds the message into a Single Order Container, the receiving container will take complete control of the generated order until the order is filled or deleted.

Example. Using Single Order Container in conjunction

Once it starts managing an order, the Single Order Container will continue to submit additional requests to reflect the changes in its Price, Quantity, Delete, Stop Trigger and Disclosed Quantity inputs (note that the container will not react to changes in the respective Order Block's inputs):

  • If the price or quantity input changes: the container will modify its managed order to reflect the change.
  • If the “del” condition turns TRUE: the container will delete its managed order. Afterwards, the respective Order Block will compare the number of fills it has achieved so far against the user-specified input quantity and submit a new order for the remaining balance, i.e., - [No. of fills achieved].

    Warning: If the "del" input for the Single Order is TRUE and the respective Order Block's is TRUE, then the two blocks could enter into an order "submit-delete" loop. To be specific, the Order Block will submit an order; the container will immediately delete the new order; and the Order Block will submit another order in response. This submit-delete sequence could continue to loop indefinitely. To prevent this behavior, the user may do one of the following:

    1. Disable "Auto Resubmit" option by double-clicking on the Order Block (see: Double-Click Edit Window for more information).
    2. Use a Not Block to ensure that the True/False input into the "del" port of the Container is always the opposite of the True/False input into the "On/Off" port of the respective Order Block. With this setup, when the Container deletes the managed order, the Order Block will not immediately re-submit a new order. Conversely, when the Order Block submits a new order, the Container will not immediately delete the submitted order.

      Example. Preventing order submit-delete loop

  • If the Stop Trigger or Disclosed Quantity changes: the container will modify its managed order to reflect the change. However, the specified Stop Trigger or Disclosed Quantity must meet the approval conditions (see Operations section above for details on the approval conditions). In addition, if the order was generated without a Disclosed Quantity, the Single Order Container will modify the order into an exchange-handled iceberg order. Note that a Stop Trigger cannot be attached to an order which was initially submitted without a Stop Trigger.

Warning: Make sure to enable "Ignore Inputs After Add" option when using the Single Order Container in conjunction. Otherwise, a single order will be controlled by both the Order Block and its respective Single Order Container resulting in an unexpected behavior.