In the Quagensia® Desktop Application’s terminology, an expression is something that calculates a value or holds data, such as a calculation that returns a numeric value, a set of conditions that evaluates to true or false, a date, a piece of text, a color, or a list or array of 100 numbers.
A Quagensia Expression Function is a Quagensia Function that returns an expression. Since a Quagensia Expression Function is an expression itself, it can be used in the same locations that other expressions can be used.
Every edition of Quagensia comes with many Quagensia Expression Functions in the “Algos from Quagensia” folder of the Algo Explorer.
You can also create your own Quagensia Expression Functions or acquire them from a highly trusted source such as a co-worker and place them in your “My Algos” folder or a subfolder of the “My Algos” folder, then access them by clicking on a location where the Quagensia Expression Function is allowed. This allows you to greatly extend the capabilities of your installation of Quagensia with proprietary expressions that simply cannot be created with the expression functions that come with your installation of your edition of Quagensia and also allows you to create a single function that contains a complex set of multiple calculations that returns a single expression that you find yourself having to build from scratch frequently and prefer to add with a single expression instead of having to constantly copy and paste the complex calculations between algos and then update all places you have copied and pasted the multiple complex calculations whenever you decide on an improvement to the complex calculations.
Using a Quagensia Expression Function is no different than using a Quagensia expression that does not come from a Quagensia Expression Function, such as the expression that holds a decimal number that can be changed by changing the number in a text box, the expression that holds a color that can be changed with a color chooser window, or the expression that allows you do arithmetic on numerical expressions. You can add a Quagensia Expression Function to your Quagensia Strategy or Quagensia Function by clicking anywhere on the algo’s workspace where the specific Quagensia Expression Function is allowed, and then clicking the context menu item that adds the specific Quagensia Expression Function to your algo’s trading logic.
You can create Quagensia Expression Functions that perform actions and can be used in locations where either expressions or actions are expected. (Recommended for advanced users only)
Advanced users may occasionally want to create a Quagensia Expression Function, i.e. a function that returns an expression, and check the check box in the “Function Summary” section labeled “Can Be Used As An Action (Return Value Will Be Ignored When Used As An Action)” so that the Quagensia Function can be used both in a location where an expression is expected as well as in a location where an action is expected.
Quagensia Functions that do an action but can be used as an expression can be dangerous, because not all users will understand that something that they can place in a location where an expression is expected may also do something more than merely calculating a value or evaluating an expression like submit an order. For instance, if you create a Quagensia Function that submits an order and then returns a Boolean (true or false) value that indicates if the order was submitted successfully and share this function with another user who thinks that the only way that an order could be submitted is by placing an action in a location in “When Bar Updates” where calls to order submission functions are usually placed, they may use the function in a location thinking that it will merely do a calculation and return an expression instead of submitting an order.
For your safety and for the safety of all users of any Quagensia Function that can be used as either an expression or an action, users who click on a location that expects an expression will not see Quagensia Functions that are also marked as “Can Be Used As An Action (Return Value Will Be Ignored When Used As An Action)” in the location in the context menu that corresponds to the subfolder in the “My Algos” in which the function file was placed. Instead, the function will appear under the context menu item “Replace/Set Item >> More Expressions >> Actions That Return Values” to remind the user that all the expressions that they can add from that context menu folder may do actual work, such as submitting an order.