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.
Example The Generator block has its Mode property set to Time Interval. With its enabled and repeat properties set to 'true,' it uses the input from the Number block to generate an empty discrete event message every second (1000 milliseconds) to trigger downstream logic.
The Generator block provides different modes for specifying when the block generates a discrete event message:
TimeInterval: Generates a discrete message at regular time intervals. This mode exposes the following input ports:
BoolChange: Generates a discrete message when the value of its Boolean input changes, either from TRUE to FALSE or from FALSE to TRUE. This mode exposes a Boolean input port.
BoolTrue: Generates a discrete message when its Boolean input becomes TRUE. This mode exposes a Boolean input port.
EveryStart: Generates a discrete message when the algorithm initially launches, as well as every time the algorithm is paused and then resumed.
InitialStart: Generates a discrete message once at the launch of the algorithm, then becomes inactive for the life of the algorithm.
At Start Time: Generates a discrete message a specific time or specific date and time. This mode exposes the following ports:
Note: If you do not specify a date, the event will repeat daily at the specified time.
At Start Time-Combined: Generates a discrete message at a user-specified date and time. This mode shows the Date Time block setting that allows you to select the date and time from a calendar. It also exposes a Number port that outputs the UTCDateTime as the number of milliseconds since UNIX epoch (Thursday, January 1, 1970). You can use this value for downstream time-related comparisons and calculations.
Unlike the At Start Time mode, this mode does not expose input ports for the start time; 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.
UserTrigger: Waits until a user triggers the block to generate a discrete message.
When using this type of generator, a button is added to the Algo Dashboard. Clicking the button triggers the generator. The algo must be deployed to test this trigger.
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:
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:
To customize the block, update the Block Properties.
|Name||Name to display beneath the block on the ADL canvas|
|Mode||When the block should generate its discrete event message|