Order of Discrete Event Message Propagation
Understanding the granular order in which the variables are updated is one of the most crucial elements in mastering advanced programming techniques in ADL.
When a block outputs a pulse of discrete event message, an algorithm temporarily stops channeling continuous messages from the exchange servers. Continuous message channels will remain closed while the pulse of discrete event message propagates throughout the algorithm. In effect, this behavior will "freeze" the output of blocks such as the Instrument Field Block which channels streaming market data. In this static state, the pulse of discrete event message will traverse the pathway designed by the user, updating the output values of the blocks which lie in its path. Once this propagation is complete, the algorithm will resume channeling continuous messages from all exchange servers.
Note that such propagation takes place within microseconds and will not be perceivable in practice. With this mechanism, however, ADL allows the user to capture and use the market data existing precisely at the moment of a discrete event. The following ADL rules govern the exact order in which the blocks are updated as a discrete event message propagates:
During the propagation, when a discrete event message enters a Pass-Through Block (i.e., any block which receives and passes on a discrete event message unchanged):
- The continuous output values of the pass-through block itself is updated first.
- Any "downstream" block which uses the continuous output values of the pass-through block is updated.
- The discrete event message exits the pass-through block.
- The discrete event message continues to propagate through the designed pathway until it hits a termination point (see next bullet point).
Example: Order of updates upon entering a “pass-through” block. This example shows how the discrete event message will first update the blocks connected "downstream" from the pass-through block before exiting the pass-through block.
A discrete event message propagates along its path as far as possible and terminates upon entering any one of the following blocks:
- Termination Block: Single Order Container, State Block, Accumulator Block, Discrete Order Block, Stopwatch Block, Pause Block, Spread Fill Generator Block, Alert Block, and "Reset" input ports
- Pass-Through Block with no discrete pathway extending beyond it
Example: Termination point