# Blocks

## Block types

ADL provides a variety of block types that ensure you have the necessary tools to create both simple and complex algorithms:

• Trading blocks allow your algo to communicate with markets, including retrieving market data and status, getting trade data, submitting new orders and managing existing orders. Trading blocks primarily process continuously-updating data, such as price updates.
• Discrete blocks allow an algo to monitor and manage data from discrete market events that occur during algo executions, including extracting information from fill confirmations and taking action when an event occurs.
• Arithmetic blocks provide the tools for your algo to perform mathematical computations using data from other blocks. For example, arithmetic blocks can calculate an order price two ticks away from the inside market.
• Basic blocks let your algo define or get user-defined input for numerical and Boolean values.
• Logic blocks allow an algo to make processing decisions based on logical conditions, such as determining at which price level to submit an order based on which level has a higher available quanity. Logic blocks primarily generate Boolean outputs.
• Miscellaneous blocks provide functionality not fitting into the other block types, including controlling timing, repeating actions, generating alerts and adding informational notes to your algo.

## Block inputs and outputs

Each block in ADL can be thought of as a processing unit: it takes in a number of inputs, processes the inputs according to its unique functions, and then outputs the results. As such, every block has input and output ports, with the inputs located on the left side of the block and the outputs on the right side.

Every block has its own inputs and outputs.

ADL blocks support five different types of input/output ports. The ports are distinguished according to the type of information that flows through each. To help you easily identity the different port types, ADL uses different colors for each type of port and uses light shades for input ports and dark shades for output ports.

• Numeric port: Inputs/outputs an integer or decimal number. Numeric ports are colored light and dark red.

For example, an Add block has numeric input and output ports.

• True/False port: Inputs/outputs either a True or a False (also called Boolean values). True/False ports are colored green.

An And block has True/False input and output ports.

• Instrument port: Inputs/outputs market data for an instrument. Instrument ports are colored blue.

For example, an Instrument block has an instrument output port.

• Variable port: A variable port can turn into any one of the above three types. When you connect an output port of one type (e.g. numeric) into a Variable input ports located on a block, all other Variable ports on that block will automatically change to that type (ex. all other Variable ports will shift into Numeric ports). Variable ports are colored yellow.

For example, an If-Then block has variable input and output ports.

If you connect a numeric value to the variable port, the yellow variable ports change to red, as associated with numeric ports.

• Discrete Event Message port: Inputs/outputs discrete event messages that are generated by several designated blocks whenever a significant market event, such as a fill, occurs. Discrete event message ports are colored white or black.

For example, a Branch block has discrete input and output ports.

## Notifications for missing required block inputs

Every block in ADL has one or more required inputs. When you add a block to the canvas, the Problems tab in the Information Panel lists errors for each required input. As you connect the inputs, the error messages are removed.