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). For example, when this functionality is enabled, the Add block will either perform an addition or a subtraction depending on the value of the Order Side variable.
Example A bi-directional strategy using Flip For Sell Orders functionality (with flip-for-sell enabled blocks highlighted)
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.
In Trade widgets, such as Algo Dashboard, a Side variable 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.
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.
The following blocks support flip-for-sell functionality: