Try TT Now

ADL®

Generator Block

Operations

The Generator Block produces an empty discrete event message at the launch of the algorithm. The Generator Block can be used to trigger other Discrete Blocks at precise moments in time.

Double-Click Edit Window

Double-click on the block to bring up an edit window:

  • OnInitialStart: When selected, the Generator Block generates a message once at the launch of the algorithm, and will be inactive for the life of the algorithm.

    Example. OnInitialStart

  • OnBoolChange: When selected, the Generator Block exposes a True/False input port. The block will generate a message when this True/False input changes from FALSE to TRUE and from TRUE to FALSE.

    Example. OnBoolChange

  • OnBoolTrue: When selected, the Generator Block exposes a True/False input port. The block will generate a message when this True/False input changes from FALSE to TRUE.

    Example. OnBoolTrue

  • OnTimeInterval: When selected, the Generator Block will generate a message at regular time intervals set by the user. The minimum interval is 100 milliseconds.

    Example. OnTimeInterval

  • OnEveryStart: When selected, the Generator Block will generate a message at the launch of the algorithm and every time the algorithm is paused and then resumed.

    Example. OnEveryStart

Details On Timing

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

When OnInitialStart or OnEveryStart 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.

Example. GeneratorBlock set to OnInitialStart

In this example, the following sequence of events occurs when the algorithm is started:

  1. The Order Block places an order at the best bid price of the selected instrument.
  2. The Generator Block (set to OnInitialStart) generates and pushes a discrete event message downstream, instructing the Order Block to delete the order.

When OnBoolChange or OnBoolTrue 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.

Example. GeneratorBlock set to OnBoolTrue

In this example when the Boolean output of the Less Than Block turns to “True,” 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. The Alert Block generates an alert.
  3. The Generator Block (set to OnBoolTrue) generates and pushes a discrete event message downstream, triggering the Pause Block.