Investment Studio > Views > System > Rules
Under Rules, you specify how and when transactions are to be generated by the portfolio's trading system.
The system's date range (start date to end date) is set using the date controls in the toolbar. Individual rules are entered in the grid below the toolbar:

| The system is executed (1) when it's been modified and you leave the System view and (2) whenever the underlying data (quotes, manually specified transactions) changes. Any old soft transactions in the system's date range are deleted prior to system execution. |
The toolbar contains five control groups. They can be repositioned by dragging their beveled "grip"
![]()
and hidden by unchecking the corresponding entry in the pop-up menu's Toolbar submenu (right-click the grid or the toolbar to open it). With the exception of the date range controls, all toolbar controls also have functional equivalents in the pop-up menu.
| The toolbar is visible only if it contains a least one visible control group and is itself set to visible. |
|
|||||||
|
|
|||||
|
|
||||||||
|
|
|||||
|
|
|||||||||||||||||||||||
|
The system's rules are directly responsible for transaction generation. The rule records listed in the Rules grid therefore reflect the structure of transaction records: each rule must specify an asset, a number of units, a principal value, any fees and an optional message (to be displayed as a comment in the Transactions view). A boolean condition determines when the rule generates a transaction:

Rules can be added, copied and
deleted using
in the toolbar
or the Rules submenu in the grid's pop-up menu.
The rule records fields are:
| Field | Interpretation |
| Nr | A unique integer number > 0 identifying
the rule. Assigned automatically when the rule is
created. Read-only,
but rule records can be renumbered collectively by grid
position using Position > Renumber in the
grid's pop-up menu or The rule number can be read by expressions in the Rules grid using the built-in symbol RULE. This can be used to generate messages (for display in the Transactions view) which identify the rule responsible for creating a transaction; see the screenshot above for an example. |
| Asset | An asset symbol specifying the transaction asset for all
transactions generated by the rule. Permanently assigned when the rule is created. Read-only. If you enter a rule and then discover that you got the asset wrong, copy the rule to the correct asset, then delete it. |
| Enabled | Must be checked for the rule to have any
effect. Rules which are not enabled are simply ignored
upon system execution. Use the date range control to disable the entire system. |
| Condition | A boolean expression which must = TRUE for a
transaction to be generated. In practice, this is usually a reference to an expression in the Symbols grid. |
| Units | A float expression specifying the number of asset
units involved in the generated transaction (see Transaction units). In practice, this is usually a reference to an expression in the Symbols grid. |
| Principal | A float expression specifying the principal value
of the generated transaction (see Transaction value). In practice, this is usually a reference to an expression in the Symbols grid. |
| Fees | A float expression specifying the cost of the
generated transaction (see Transaction fees). In practice, this is usually a reference to an expression in the Symbols grid. |
| Flag | A string expression specifying the content of the
flag field in the generated transaction record. Transaction flags can be read using the asset_flag and portfolio_flags functions and used to keep track of state changes in the trading system. Another possible use it to give the Portfolios or Assets views advance warning about the trading system's intents for tomorrow, before the quotes needed to book actual transactions become available. |
| Message | A string expression specifying the content of the custom property _COMMENT in the generated transaction
record. Note that the Transactions view's Grid object must be set up with a corresponding custom property definition for the message string to be displayed there. Tip: use the built-in symbol RULE to obtain the rule's number and create a message (for display in the Transactions view) which identifies the rule responsible for generating the transaction (see screenshot above). |
| Comment | A free-format comment. Has no effect on
rule evaluation or system execution. Should not be confused with the message field! |
All asset symbols and built-in symbols available in Symbol grid expressions can also be used in Rules grid expressions.