Advanced concepts

Advanced concepts

Advanced Exit Block Functionality

An Exit Block is used within virtualized group blocks, and is used to dispose of unwanted or unnecessary instances. To add an Exit Block to an algorithm, right click on the canvas within a virtualized group block and select "add exit block". Using either the Boolean or discrete message inputs, you can build logic in your algorithm to dispose of virtualized instances whenever they are no longer needed.

Not using the Exit Block, in some case can affect the efficiency of the algorithm, and may cause latency issues. This is because whenever a virtualized instance is created it is saved to memory and ADL has to update each virtualized instance - the more instances it has to update, the longer this process will take.

Simulation Example

You have an entry side order that is placing 1000 1 lot orders, and you are wanting to work each individual 1 lot entry side order for a 1 tick profit price. You have your entire exit side hedge logic virtualized.... and you build in the EXIT Block to trigger inside each of the virtualized instances when you get filled on your hedge logic.

Then set up the logic structure with your 1000 virtual instances, with exit block logic attached to an input connector (continuous boolean). Attach a user defined Boolean block to the input you just created. Start up your algorithm and monitor the system resources being utilized on your server while the algorithm launches those thousand virtualized block instances. Wait for the resources (memory, swap file, cpu etc) to equalize.

When you switch that Boolean block to trigger all of those exit blocks at once, you should see some resources being freed up once .NET triggers the garbage collection.

When a Virtualization is Generated by a Discrete Message:

  1. The blocks inside a virtualized grouping are created.
  2. The continuous inputs on each of these blocks is populated (if there are any).
  3. The discrete message that induced the creation of this copy of a virtualization flows through its pathway.
  4. Any blocks that have actionable features will execute. Generally speaking, an action block in this context is one that could interact with the market at any point in an algo’s life. For example, order management blocks.

When an Exit Block (that uses the continuous input) is triggered:

  1. The moment that the Boolean continuous input turns from false to true on the Exit Block, the virtualization schedules an exit. No action is taken yet.
  2. The continuous inputs on each of the virtualized group’s blocks are updated. In other words if the changes in the algo that prompted the Boolean change (used for triggering the Exit Block) also prompt other continuous values to change, these changes will occur.
  3. If these continuous value updates trigger action blocks to do something, these actions will indeed take place.
  4. The Exit Block will implement what it’s designed to: ADL will dispose of the virtualized grouping’s instance.

When an Exit Block (that uses the discrete input) is triggered:

  1. The discrete message used to trigger the Exit Block is part of a pathway, so to speak. It could be the final block on the pathway or part way through it (for example if it is the first item triggered from a Sequence Block and the other outputs of the Sequence Block are used). When this discrete message is generated from its source,the entire pathway is completed. So all items downstream from a triggered Exit Block will update because they are all on that same discrete message pathway.
  2. If this pathway’s updated values trigger action blocks to do something, these actions will indeed take place.
  3. The Exit Block will implement what it’s designed to: ADL will dispose of the virtualized grouping’s instance.