Designating a block as a variable allows the user to alter the output value of the block while the algorithm is running. In addition, some variable blocks can be linked to Microsoft Office Excel allowing the user to alter the block's value directly through the Excel sheet (see: DDE Functionality for more information).
The following blocks can be designated as a user-defined variable:
- Constant Number Block
- Boolean Block
- Instrument Block
Note: The value of a user-defined Instrument Block cannot be altered while the algorithm is running; it must be set prior to the launch of the algorithm.
Recommended Tutorials For This Section
For a tactile learning experience, please try the following tutorial:
Example: Variables Tab in the Information Panel
When a block is designated as a user-defined variable, its information appears as a new entry in the Variables Tab of the Information Panel, allowing the user to reconfigure the name, value, type, and the description of the variable.
How to designate a block as a variable
Right-click on the block and navigate to the option "Variable." Under the option, several types of variables available for the respective block will be displayed. Upon a selection, a check mark will appear to the left of the selected variable type, indicating that the block has been designated as a variable.
Example: Designating a Constant Number Block as a User-Defined Variable
Using the Variables Tab
The Variables Tab in the Information Panel enables the user to quickly view and reconfigure the following aspects of a variable:
- Name: The name of the variable as it appears on the Designer canvas as well as on any location from which the algorithm can be launched (e.g., Algo Dashboard).
- Value Type: The output type of the variable; either Instrument, Numeric or Boolean (i.e., True / False).
- Default Value: The value of the variable. By default, this field is set to the value assigned by the user on the Designer canvas.
Variable Type: The method by which the user assigns the value of the variable.
- User-defined: When this option is selected, the value of the variable can be assigned through the Algo Dashboard.
- Order Price / Qty: Available only for the Constant Number Block. To understand this functionality please view Creating and Launching Order Ticket Algorithms (OTAs). When this option is selected, the value of the Constant Number Block is set to the price / quantity specified by the user directly on the MD Trader® Window.
- Order Instrument: Available only for the Instrument Block. To understand this functionality please view Creating and Launching Order Ticket Algorithms (OTAs). When this option is selected, the value of the Instrument Block is set to the instrument specified on the MD Trader window.
- Order Buy/Sell: Available only for the Boolean Block. When this option is selected, the value of the Boolean Block becomes tied to the Order Side variable. For instance, if the value of the Boolean Block was set to True when Order Side is “Buy,” the block will reverse its value to False when the Order Side is “Sell.”
- Description: Text description of the variable. This information will not be used or displayed elsewhere.
- Binocular Icon: When the user clicks on the binocular icon located to the left of the variable name, the canvas will zoom, center, and highlight the associated block.
Note: Variables can be rearranged using the drag-and-drop method. After deployment, the order of the variables is reflected within the Algo Dashboard window, Parent Order Book window, and Algo Variables dialog within X_TRADER.