Article Contents
Print

Named Terms, Private Terms & Selector Terms

Named Terms provide the information required by your trading rules, which may be a Value (number or percentage), Condition, Security, Security List (called a benchmark list, to avoid confusion with trading lists), or a Price Indicator value. Or it may be a Persistent Term, which is data that persists between ShareScope sessions, thereby providing a ‘memory’ for your trading system. Shared terms can be used anywhere in the trading spec, simply by referencing their name, so all terms must have a unique name.

Creating Named Terms

Terms are created in the Shared Terms or Strategy Terms tabs of the Trading Specification Definition  dialog, or in the Private Terms (see below) area of the DEfT Wizard, below the main definition for a Named Term, Trading Rule or List Selector.

To  create a term, simply select the Create option in the Definition Operations drop-list then click the Do It! button. The DEfT Wizard will then be displayed, which will lead you through the creation process.

To  edit a pre-existing term, just click the Edit button next to the Term’s definition. The DEfT Wizard will again be displayed, this time in edit mode.

Why Use Terms?

Terms simplify things by replacing complex expressions with simple names that return the value or state of the expression. So for example, the horribly complex condition:

‘Buy Rising Price’ = a condition that is true if the evaluated security’s long channel’s trend today, is rising, AND the evaluated security’s medium channel’s trend today, is rising, AND the evaluated security’s close price (£) has a growth rate greater than or equal to 0.2%, for at least 4 of the last 5 days, AND the evaluated security’s profit (£ final), over the last 3 years, has a growth-rate ranked in the top 10% of securities in the trading universe list (pre-sampling), after selecting those securities whose sub-sector is the same as the evaluated security

…becomes much more manageable and understandable, when it is broken into sub-terms with meaningful names:

‘Buy Rising Price’ = a condition that is true if the ‘Long Trend Is Up’ term is true, AND the ‘Medium Trend Is Up’ term is true, AND the ‘Price Is Rising Fast’ term is true, AND the ‘Its The Most Profitable In Its Sector’ term is true; where:

  • ‘Long Trend Is Up’ = a condition that is true if the evaluated security’s long channel’s trend today, is rising
  • ‘Medium Trend Is Up’ = a condition that is true if the evaluated security’s medium channel’s trend today, is rising
  • ‘Price Is Rising Fast’ = a condition that is true if the evaluated security’s close price (£) has a growth rate greater than or equal to 0.2%, for at least 4 of the last 5 days
  • ‘Its The Most Profitable In Its Sector’ = a condition that is true if the evaluated security’s profit (£ final), over the last 3 years, has a growth-rate ranked in the top 10% of securities in the ‘Sector List’ security list
  • ‘Sector List’ = the trading universe list (pre-sampling), after selecting those securities whose sub-sector is the same as the evaluated security

Another advantage of breaking expressions into sub-terms is that the calculation of each term can be tracked in the Execution Report, and their value over time can also be displayed as Chart Overlays or Indicator Overlays. This makes it much easier to determine why the overall ‘Buy Rising Price’ term’s condition was true or false.

The Utility Of Constant Terms

Constant terms (those defined by invariant data, such as a fixed number or logical state, rather than an expression whose value may vary over time), can be used as parameters to control your Live trading system, by setting their values using the System Parameters tab of the Live Dashboard. This allows you to modify your specification’s key values, without recompiling it each time.

If you’re not sure what value to use, or if you want to test how sensitive your system is to a particular number (such as a threshold), you can also vary constant terms over a range of values using RuleTrader’s Batch Test facility.

Constant terms are also the only terms (other than Selector Terms) that can be accessed by List Selector definitions.

Private Terms & Selector Terms

Editing a term definition using the  DEfT Wizard

Private Terms are terms defined in the private terms area of a Term, Trading Rule or List Selector, which are only used by their parent definition (i.e. the Term, Trading Rule or List Selector). In List Selectors, private terms are called Selector Terms due to some differences in the way they are defined and the terminology used in those definitions.

An example of private term definitions is given in the image above, which shows the DEfT Wizard in Edit mode for the Example Trading Spec’s ‘Value & Growth Buy List’ strategy term. As you can see, the private term area is displayed in a section below the main definition area.

The name of a private term must be different from other private terms defined under the same parent definition (their siblings) and from any definitions defined at the Shared or Strategy levels. However, they can have the same name as other private terms defined in other definitions. This is required to make the reference to the term’s name unambiguous, when it is used in a rule or other term’s definition.

If a term is only going to be used by one definition then you should always define it in that definition’s private terms area (or move it there by cutting and pasting it). This has 2 advantages:

  • it reduces the number of terms whose names you must keep unique
  • it reduces the number of terms defined in the limited area available for defining Strategy and Shared Terms. See the section ‘Where Should Your Definitions Go?‘ in the Trading Specification Definition Dialog help topic.

Selector Terms must always be defined in this way, as they and their parent List Selector definitions cannot access the values in Shared or Strategy Terms unless those other terms are defined as constants i.e. they are defined with a specific numeric, percentage or conditional state value and not with an expression whose value is changeable.

Scroll to Top