# Discrete Order block

The Discrete Order block is a trading block that submits a “one-shot” order for the specified instrument at the price and quantity specified by the user every time it receives a discrete event message. Unlike an Order block, the Discrete Order block does not manage an order once it submits it. The Discrete Order block will not update the working order to reflect any changes in the inputs after the initial submission; however, the block will delete the working order when the user pauses or stops the algorithm. In addition, the block will not resubmit when the generated order is automatically or manually deleted.

Example Once a Discrete Order block receives a discrete message from an upstream block, the Discrete Order block submits an order for an instrument based on a formula written in the block's properties. The Discrete Order Block outputs a discrete message to downstream blocks when the order is submitted.

When it receives an order add confirmation, the block generates a discrete event message through its Add Ok output port.

## Formulas for specifying the order information

Unlike an Order block, the Discrete Order block does not get its order price, quantity, or enabling conditions from inputs to the block. Instead, it uses formulas to specify these values, which are accessed from the block properties. The Fields Formula Editor lets you use information from the incoming discrete event message and any other block values to calculate a value.

Example Specifying a formula for the order quantity

In this example, order quantity formula divides the value of a BidQty Field block by 2 to set the order qty to half the available quantity.

For lists of possible values for the orderType and timeInForce formula parameters, refer to the Number block help.

## Discrete Order block connected to a Single Order Container block

The Discrete Order block can be used with the Single Order Container to allow the Single Order Container to manage its order. When the Discrete Order block successfully generates an order, the block outputs a discrete event message. If you connect this message to the input of a Single Order Container, the Single Order Container will take complete control of the generated order until the order is filled or deleted by the Single Order Container, or until a new order is generated by the Discrete Order block.

Note The Single Order Container can only manage a single order at a time. If the Discrete Order block generates a new order while the Single Order Container is occupied, the Container will be forced to forfeit the control of the current order in order to accept the new one.

Example Connecting to a Single Order Container for a Buy entry order

## Block properties

To customize the block, update the Block Properties.

Property Description
Name Name to display beneath the block on the ADL canvas.
Side Whether the order represents a Buy or Sell order.
Flip for Sell Order Whether to enable a single algorithm to act either as buy or sell side routine as needed.

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 Discrete Order block will submit either buy or sell orders depending on the user's selection of the Order Side variable (see: Flip For Sell Orders Functionality for more information).
Qty Formula Equation used to calculate the value of the block.

If not yet defined, the field displays a Click to edit formula link that opens the Formula Builder.
TIF How long to leave a generated order working in the market.

Choices include:
• Day to leave the order working until the end of the trading session
• GTC to leave the order working until manually canceled
• IOC to cancel any remaining order quantity that is not filled immediately
• FOK to cancel the order if it is not completely filled immediately
Condition Formula Equation used to calculate the value of the block.

If not yet defined, the field displays a Click to edit formula link that opens the Formula Builder.
When Ext Mod Occurs Action to take if the order is modified outside of the algorithm:
• Ignore to continue using the block inputs and ignore the external modifications
• StopManaging to ignore the block inputs and use the external modifications instead
• Detach to ignore the block inputs and stop sending block outputs

Note The purpose of this setting is to pass the desired behavior on to a downstream block, such as the Single Order block.
Leave Child Order On Whether orders generated by the Discrete Order block should remain in the order book even if the algorithm is paused or canceled.

A paused state can result from a client side connection drop.
Order Tag

Custom text to display in the Order Tag column of the Fills widget for orders generated from this Discrete Order block. If the algo is launched with an Instance name in Algo Dashboard, the TextTT field for all child will be concatenated with with parent order's TextTT field.

For example, suppose you set this field value to OT123 and the algo is launched from the Algo Dashboard as follows:

The TextTT field of the algo parent order is set to MM 3x10. The TextTT field of each child order submitted by this algo is set to MM 3x10:OT123.

By assigning text to each order, you can quickly sort and filter child orders of this algo in the Fills widget based on the TextTT column.

OpenClose / Strategy flags

When set to True, this allows users to enable and define the Open/Close, TradingStrategy, and ReverseSpreadOC flags:

• OpenClose: Defines the Open, Close or FIFO (first in, first out) of the trade itself:
• Open
• Close
• FIFO
• TradingStrategy: Defines the type of trading strategy for the order. Trading strategy indicator. Supported for orders on certain China market connections only. Supports the following values:
• Arbitrage
• Hedge
• Directional
• ReverseSpreadOC: Sets whether to reverse the spread on open/close.Indicates whether to reverse the open/close flag on the far leg of a spread order. Mandatory on DCE and CZCE multi leg orders. Supported for orders on certain China market connections only. Supports the following values:
• Do not reverse open close flag on far leg
• Reverse spread open close flag on far leg
Clone incoming order Whether to clone an incoming existing exchange native order, SOA algo, or TT Algo that is on hold. Enabling this setting lets users launch an OMA from an MD Trader widget.

When enabled, the block clones the incoming order, so you must connect the Add OK output port to a downstream Single Order Container block.
Formulas Formulas for determining the order's price, quantity, and condition.

The edit link opens the Fields Formula Editor to define or display the formulas.
Order Color

Color to display next to orders generated by this block in the TT MD Trader and Order Book widgets, similar to the following.