ADL®

Generator Block

The Generator Block produces an empty discrete event message at the launch of the algorithm. As the message is empty, it contains no market information; however, an empty discrete message can be used to trigger other blocks that use discrete messages as inputs, such as a Pause block. The Generator Block can be used to trigger other discrete blocks at precise moments in time.

Generator modes

The Generator Block provides different modes for specifying when the block generates a discrete event message:

  • InitialStart: Generates a discrete message once at the launch of the algorithm, then becomes inactive for the life of the algorithm.

  • EveryStart: Generates a discrete message when the algorithm initially launches, as well as every time the algorithm is paused and then resumed.

  • UTCDateTime-Discrete: Generates a discrete message a specific time or specific date and time. This mode exposes the following ports:

    • hour, minute, seconds, milliseconds: Time to generate the message.
    • month, day, year: Specific date to generate the message. These ports are shown only if you add a UTCDate connector in the Block Settings.
    • Note: If you do not specify a date, the event will repeat daily at the specified time.

  • UTCDateTime-Combined: Generates a discrete message at a user-specified UTCDateTime. This mode shows the Date Time block setting that allows you to select the date and time from a calendar. Unlike the UTCDateTime-Discrete mode, this mode does not expose input ports for the value; however, it is automatically declared as a user-defined parameter. A calendar widget will be displayed in Algo Dashboard / Autotrader to allow the user to specify a value.

  • BoolTrue: Generates a discrete message when its True/False input becomes TRUE. This mode exposes a Boolean input port.

  • BoolChange: Generates a discrete message when the value of its True/False input changes, either from TRUE to FALSE or from FALSE to TRUE. This mode exposes a Boolean input port.

  • TimeInterval: Generates a discrete message at regular time intervals. This mode exposes the following input ports:

    • enabled: Whether to activate the block
    • repeating: Whether to continue sending messages at the specified interval
    • periodMs: Number of milliseconds between messages. The minimum interval is 100 milliseconds.
  • UserTrigger: Waits until a user triggers the block to generate a discrete message.

    When using this type of generator, a button is added to Autotrader. Clicking the button triggers the generator. The algo must be deployed to test this trigger.

Timing considerations

When using the Generator Block, it is important to know the exact timing at which the discrete event messages are generated.

When InitialStart or EveryStart is selected, the following sequence of events occurs when the algorithm is started:

  1. All “actor” blocks (i.e., blocks that can take tangible actions such as placing an order) first perform their actions. For a list of actor blocks, refer to Actor Blocks.
  2. The Generator Block generates and pushes a discrete event message downstream.

When BoolChange or BoolTrue is selected, a continuous update changes the value of the Boolean input on the Generator Block and the following sequence of events occurs:

  1. The Generator Block does not generate a discrete event message immediately - it allows the continuous update to propagate completely throughout the algorithm.
  2. All “actor” blocks (i.e., blocks that can take tangible actions such as placing an order) first take their actions. For a list of actor blocks, refer to Actor Blocks.
  3. The Generator Block generates and pushes a discrete event message downstream.

Block settings

To change default block settings, double-click the block to open the Block Editor.

Setting Description
Name Name to display beneath the block on the ADL canvas
Mode When the block should generate its discrete event message
Description Optional text to explain how the block is used