← Back to X_TRADER® Help Library

ADL® Documentation

Building Blocks

Each building 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.

Recommended Tutorials For This Section

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

  • ADL Building Blocks


Example: Every block has its own inputs and outputs


The user can connect one block's output port to another block's input port, ultimately articulating the overall logic of the strategy. However, connections are allowed only between two compatible port types. To be specific, there are five different types of input/output ports in ADL and connections are limited to ports of the same type.

The ports are distinguished according to the type of information that flows through each:

  • Numeric port: Inputs/outputs a rational number. Numeric ports are colored in red, with the input of lighter shade than the output.

    Example: 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 in green, with the input of lighter shade than the output.

    Example: And Block has True/False input and output ports

  • Instrument port: Inputs/outputs the name of an instrument. Instrument ports are colored in blue, with the input of lighter shade than the output.

    Example: Instrument Block has an instrument output port

  • Variable port: This port can turn into any one of the three aforementioned types. When the user feeds one type of input (ex. Numeric input) into one of the Variable input ports located on a block, all other Variable ports on that block will automatically be unified in type (ex. all other Variable ports will shift into Numeric ports). Variable ports are colored in yellow, with the input of lighter shade than the output.

    Example: If-Then-Else Block has variable input and output ports

  • Discrete Event Message port: Inputs/outputs a special type of information called a discrete event message that is generated by several designated blocks whenever a significant market event (e.g., fill) occurs. Specifically, discrete event messages are generated whenever the user's algorithm submits or receives a message from an exchange server. The messages range from add requests to fill confirmations. Discrete event message ports are colored in white or black, with the input in white and the output in black.

    Example: Branch Block has discrete input and output ports


Note: An input port can receive only a single feed, whereas an output port can link to multiple inputs.