Many automated strategies in ADL will have nearly identical buy and sell side routines, with certain blocks acting as "pivot" points. As such, several blocks in ADL will have the option "Flip For Sell Orders" functionality which enables them to perform an alternate function depending on the user's selection of the Order Side Variable (either Buy or Sell).
This variable will appear automatically for any algorithm containing a block with the "Flip For Sell Orders" functionality enabled, and the user must set this variable prior to launching an algorithm.When a block is enabled with the functionality, it will turn dark red in color, indicating that it will perform an alternate function should the user change the value of the Order Side Variable.
Example A bi-directional strategy using Flip For Sell Orders functionality
Note Certain parts of the above strategy must be virtualized to function correctly. The virtualization is not shown for the sake of clarity in the illustration.
You must always design from the buy side routine and then enable the Flip For Sell Orders functionality for the appropriate pivot blocks in order to switch to the sell side routine. The user may alter the value of the Order Side Variable through one of the following methods, but note that the Order Side Variable must be declared prior to launching an algorithm and cannot be changed post-launch.