An algo in ADL represents programmatic logic visually as:
To give you an idea of how the blocks and edges work together, take a look at the following algo that is designed to submit a buy order for all available quantity at the opposite inside market when the available quantity falls below a user-defined value.
To achieve its purpose, the algo uses the following blocks and connectors:
Because the purpose of the algo is to submit an order to the market, it needs an Order block to submit the buy order to the exchange. An order minimally requires an instrument, order price, and order quantity, which are represented as inputs to the Order block.
Note The Order block also contains a variety of output ports that can be used to send its information to other blocks in the algo. You can learn more about these types of output ports in TBD.
To identify the instrument for the Order block's inst input, the algo uses the Instrument block. In this case, the Instrument block is configured to let the user select an instrument each time the algo starts.
To specify the Order block's price and qty inputs, the algo includes two Field blocks. These blocks are connected to the Instrument block so they can retrieve live market data for the best bid price and quantity from the user-defined instrument.
The Order block also contains an on/off input that optionally can be used to enable the block only when certain conditions are met. In this case, the on/off input ensures the algo submits an order only when the available quantity at the best bid is less than a user-defined value. To calculate the value, the algo uses a Number block block to get the desired threshold quantity from the user (or use 20 by default). The Less Than block takes its inputs from the Field and Number blocks and outputs a Boolean value that is passed to the Order block's on/off input connector. When the value is true, indicating that the available quantity at the best bid is less than a user-defined value, the algo enables the Order block so it can submit the order.