Article Contents
Print

The Strategy’s Trading List Selector

Every trading strategy requires a trading list. Think of it as the short-list of shares that the strategy may wish to trade at some point. One or more strategy List Selectors each pick a list of shares, either from the Trading Universe list (more of this later), or from one of ShareScope’ s built-in share lists or portfolios. These individual lists are then merged and deduplicated to create the strategy’s final trading list.

  1. For now, we’ll just create a single List Selector to select the strategy’s whole trading list. To do this, click on the Strategy Lists tab selection button on the bottom left of the Trading Spec dialog. Then, like all definitions, we define the List Selector by selecting the Create option from the Operation drop-down list, at the bottom of that tab, and clicking Do It!
The strategy's List Selectors are defined using the Trading Spec dialog's List Selector tab, by selecting the Create operation and clicking Do It!
  1. Again, we’ll be taken to the DEfT Wizard but this time, as we’re not editing an existing definition (like we did with the place-holder strategy activation definition), we enter the Wizard in create mode, which is indicated by the fact that there is no longer a blank ‘WAS:’ and ‘NOW:’ line above the input line.
DEfT Wizard in create mode ready to build the Trading List selector

As you can see, the Wizard is divided into an upper and lower section. The upper section is for defining the main definition and, when the Wizard is first opened, it is where the input line is shown. The lower section is for defining zero or more Private Terms, as required for use by the main definition, as we’ll soon see.

Somewhat confusingly, in List Selectors (only) private terms are called Selector Terms, as they have a slightly restricted range of definition options. This is because they are optimised to deal with the very large number of instruments in the ShareScope database. All other Private Terms only have to deal with the much smaller number of securities in the strategy’s trading list, so they support a wider range of definition options, as we’ll see later.

  1. Because of the large number of potential securities, it is very good practice to divide the list selection into stages, as we’ll now do, using these Selector Terms. To get started, select Create from the Operation list and click Do It! to create the first Selector Term. This causes two things to happen
    • the input line moves down to the lower half of the Wizard, ready to create a Selector Term.
    • a place-holder name ‘<list 1>’ is created for the undefined main List Selector definition, with an Edit Definition button. This is so we can go back and finish the main definition, once we’ve created its Selector Terms.
The DEfT Wizard ready to create the List Selector's first Selection Term
  1. The first selector term we’ll create will select all those shares in the Trading Universe with a spread below 2% and market capital over £50M. Once we’re done, the definition will read:

‘Small Cap’ = the trading universe list, after selecting those securities whose spread (average) is less than or equal to 2%, AND whose market capital (£) is greater than or equal to 50

  1. Enter the name Small Cap in the first field then select the term’s type from the drop down. We want it to be a trading list. When that’s done, click Next
  2. On the next Wizard page, we can see the English language statement we’re beginnning to build and a help message tells us we need to ‘Specify how the list of securities should be selected’ and offers a list of options in another drop-down (which are all explained here).

As we’re selecting securities based on whether they meet our spread and market cap criteria, we pick the list of securites that meet a condition option, before clicking Next again.

Picking the condition list selection option for the Selector Term
  1. We’re now asked to ‘Choose the list of securities to select from’. We’re using the trading universe list as our source, so that’s the option we select. We then do what we always do and click Next (which is no doubt becoming tedious to read, so we’ll not mention it anymore). You’ll see there is also a Previous button. Use this to return to previous options, if you wish to change something.
  2. The next dialog asks us to specify the selection condition for the shares and offers us a list of security values, characterisics and attributes that we can test, in order to decide if the share should be included in the trading list. Spread is an attribute of the share so pick that and …  you know what to do ‘next’. On the following dialog pick spread (average) then pick the test criteria less than or equal to a value, then percentage, then enter our required maximum spread of 2%, without the % sign. Whenever a number is required in RuleTrader only the number should be entered, without adornments such as currency symbols, comma separators or percentage signs.

At this point, have a look at the definition ‘sentence’ you’re creating above the input line and ensure it matches the first half of the definition we showed in step 4.

  1. After entering the 2% threshold you’ll see another list offering arithmetic operators such as PLUS, MINUS, etc. These allow you to define the threshold as an arithmetic expression. The ‘2%’ is the first term of that possible expression. As it’s all we need, tell RuleTrader this by selecting end expression.
Ending the numeric expression in the Selection Term's list selection expression
  1. As we’ve now defined a complete selection condition (i.e spread (average) <= 2%) the next dialog asks if we want to end selection. We don’t, as we still need to specify a market capital over £50 million, so instead we extend the selection condition by picking AND whose. As you can see, there are other options: we’d use ‘OR whose’, if we wanted shares either with a low spread, or with a minimum market capital; and we’d use ‘OR (but not both) whose’ if we wanted shares that met either criteria but not shares that met both criteria at the same time.
Ending the selection expression in the Selection Term's list selection expression

Note: There is no precedence between operators – numeric and condition expressions are always evaluated in the order they are read: from left to right. So 2 + 3 / 4 is evaluated as (2 + 3) / 4, not 2 + (3 / 4), as you may have been taught in your math classes at schools. This was a deliberate choice to make RuleTrader easy and intuitive to use.

  1. To specify the market cap selection, we simply repeat steps 8 and 9 except now, because market capital is a company result (like profit, turnover, etc.), we’ll be picking current result is then market capital and testing it against a threshold value of 50. We use 50, rather than 50000000 because ShareScope records market capital in units of millions (it’s always worth checking what units ShareScope uses for comparison tests like this).

So, the sequence of entries you need to make in the Wizard to create the market capital part of the selection condition are:

price, volume or result iscurrent result ismarket capital > GBP (£) greater than or equal to a valuenumber → “50” → end expression

Henceforth we’ll use this short-form notation as an easier to read way of describing how to create a definition. Entries will be separated by an arrow, options you need to pick will be in bold, and data you need to type in will be shown in normal weight text delimited by quotation marks (don’t enter the quotation marks themselves).

While you’re entering these definitions, please feel free to examine the different options available to you. If your explorations take you off down a side path, you can always use the Previous button to return to this step.

The notes provided on each page of the Wizard dialog will give you guidance about the different options, or you can consult the articles in this Help system, using the navigation panel on the left. The topics in the Trading Specifications Help section are a good source. And if you have any questions we can help you with, please feel free to contact RuleTrader support using the Contact Support button on the Technical Support tab of the Dashboard. We’ll be only too happy to help.

  1. You’ll be asked to specify a currency for the market capital value, which doesn’t have to be the share’s currency.

NOTE: In any arithmetic expression, RuleTrader only asks for the currency of the first term that requires a currency. Thereafter, any other currency dependent term, in the same expression, will be converted automatically to that first term’s currency. It’s another example of how RuleTrader works behind the scenes to make life easy.

ShareScope reports all values in the major currency unit (e.g. £), except for prices, which are in the minor currency unit (e.g. pence)

  1. Once you’ve clicked on end expression to end the entry of the market cap threshold expression, you’ll again be asked if you want to end selection. Choose this option, as we’ve now got both the selection criteria we required (market cap and average spread).
  2. On the next dialog, you’ll be asked if you want to end list expression, or if you’d like to add or subtract another list of shares to / from the first list to make an even bigger list. We’ve got all the list we want for now, so choose end list expression, which will also end the creation of the selector term. You should now have a trading list term called ‘Small Cap’, which is a list of shares picked from the Trading Universe based on their average spread and market cap.
Ending the list selection expression in the Selection Term

Expressions, Expressions, Expressions

It may seem a bit confusing to be asked to first end expression, then end selection, then end list expression. This is a consequence of RuleTrader’s powerful ability to nest one expression inside another. In this case, you have a mathematical expression for the market capital threshold, which is nested inside a larger selection expression, comprising both the spread criteria and the market capital criteria, which in turn is nested inside a potentially longer list selection expression, which could include multiple share list constructors that are merged together and de-duplicated (i.e. each share will appear only once, even if it is selected multiple times by the different selection conditions).

The way to deal with these end… options is to consider which part of the expression it applies to, at which level of nesting, using the rule “that which is nested first (i.e. at the highest level) is ‘ended’ last”, as suggested by the different types of brackets in: { [ (…) ] } , when it is read from left to right.

An even better way of dealing with the complexity of nested expressions is to avoid them, where possible, by breaking complex expressions into simpler to understand sub-expressions using Named Terms. More on these later. For now, if you’d like further help with understanding expressions, please consult the Help article Expressions and Sub-Expressions.

Completing The List Selector Terms

You’ve now learnt how to use the DEfT Wizard to create a definition. So lets speed things up by creating another Selector Term, then we’ll use those to finish off the main List Selector definition itself. To do this, we’ll first show you what we’re aiming for, then we’ll use the short-hand notation introduced in step 11 to tell you how to create the definition. This will give us a bit more time to focus on why we’re doing what w’re doing.

  1. Select Create and click Do It! and we’ll begin creating a new Selector Term called ‘Quality Companies’. This will sub-select from the shares in the ‘Small Cap’ security list, which we just created, to create the second layer of our selection. We’ll pick all those shares that have a ROCE (Return On Capital Employed) greater than 12%, which is a popular threshold for this ratio.

‘Quality Companies’ = the ‘Small Cap’ list, after selecting those securities whose ROCE is greater than or equal to 12%

To create this definition, use the following entries:

“Quality Companies” → trading listlist of securities that meet a conditionnamed trading list termSmall Capprice, volume or result is current result isROCEgreater than or equal to a valuepercentage → “12” → end expressionend selectionend list expression

TIPS

  1. Instead of clicking on the drop-drown option lists to open them, you can tab to the list then press the first letter of the option you want. Keep pressing that letter until the option appears. This can be a much faster way of entering a definition and will be particularly useful once you’ve familiarised yourself with the various options in RuleTrader. For now, we’d encourage you to open the lists and explore the available options.
  2. If you can’t remember how you created a definition, the Show entries in selected option in the Operation drop-down list, will generate a list of the entries that were required to create the selected definitions (i.e. that have a checkmark next to them). We used it to create the list of entries shown above.
  1. Once you’ve completed step 15, you should now have two definitions: ‘Small Cap’ and ‘Quality Companies’. Lets see how to reorder them using the Operation list. First tick the checkmark next to ‘Quality Companies’ to select it, then open the Operation list. You’ll notice a greater number of options than you’ve seen previously. These options allow you to manage your definitions and typically operate on those definition(s) that have been selected by ticking their checkmark(s). Choose Move selected up and click Do It! and the ‘Quality Companies’ definition will move above ‘Small Cap’. 
Using the Operations options to reorder definitions in the Wizard
  1. Once you’ve done that, click the Edit Definition button below the main definition place-holder ‘<list 1>’. The input line then moves back to the top half of the Wizard, ready to begin creating the main List Selector definition
Creating the main List Selector definition

Creating The Main List Selector Definition

There are two parts to a List Selector definition, as you can see here:

‘Growth Shares’ list is the top 100 securities (in descending order of each listed security’s yearly % growth of the trend in its day’s price (P), over the last 120 days (ending today)) in the ‘Quality Companies’ list. These securities are selected every quarter

The first part is the selection criteria, which we’ll use to select the top 100 shares from the ‘Quality Companies’ Selector Term list. The number of shares in the List Selector is limited using a ranking construct. This is good practice, as it ensures that back-tests will complete in a reasonable time, even if you’ve inadvertently selected 1,000’s of shares. Your first back-test will display the number of shares that were actually selected, so you can adjust the rank size then, if required.

The ranking construct has an ordering expression, which we’ll use to sort each share (the listed security) based on a price statistic – namely the growth rate of a ‘best-fit’ trend line for the share’s price-series over the last 120 trading days. The price-series used is the day’s price. This is simply an average of the share’s OHLC price on a day (specified in the System Settings tab of the Dashboard). Note that most constructs in RuleTrader work with trading days, rather than calendar days.

The second part of the List Selector definition specifies when the list is selected. This may be once, or based on a period, or based on some criteria (a condition) being met or not met. We’ll select the list quarterly, mainly to reduce the time it will take to back-test the specification in this tutorial.

NOTE: With periodic selections, the first selection always occurs at the start of the back-test (or when it is imported into RuleTrader Live), then periodically thereafter. So if we started the test on 15th February, then the list would be selected on the first trading day on or after 15th Feb, then 1st April, 1st July, 1st Oct, etc.

  1. After you’ve pressed the Edit button, create the main selector definition by entering:

“Growth Shares” → ranked list of securitiescounttopnumber → “100” → descendingsecurity’s value listed securityprice, volume or result valueprice statistic over a periodtrend % growth/year > day’sprice currency (P) → “120” → daytodayend expressionnamed trading list termQuality Companiesend list expressionevery quarter

  1. When you’re done, the entire set of List Selector definitions should now look like this:

‘Growth Shares’ list is the top 100 securities (in descending order of each listed security’s yearly % growth of the trend in its day’s price (P), over the last 120 days (ending today)) in the ‘Quality Companies’ list. These securities are selected every quarter; where:

  • ‘Quality Companies’ = the ‘Small Cap’ list, after selecting those securities whose ROCE is greater than or equal to 12%
  • ‘Small Cap’ = the trading universe list, after selecting those securities whose spread (average) is less than or equal to 2%, AND whose market capital (£) is greater than or equal to 50

You see now why we re-ordered the ‘Quality Companies’ and ‘Small Cap’ terms, it allows us to read the layered list selection in order. So you can see that the ‘Growth  Shares’ List Selector picks the top 100 shares from the ‘Quality Companies’ list, which in turn picks its shares from the ‘Small Cap’ list, which gets its shares from the Trading Universe. Layering list selection like this has a number of advantages:

  1. A series of sub-terms is a lot easier to understand than a complex, composite expression that tries to do everything at once
  2. It’s quicker to execute, as at each higher level the number of shares that must be processed is reduced by the lower levels that preceded it.
  3. It’s easier to edit if you want to change anything, as you can jump right into the appropriate part of the selection process.
  4. Later, when we introduce the idea of Overlays, you’ll see that by selecting the list in stages we can more easily examine the number of shares selected at each stage, making it easier to trouuble-shoot the list selection process.

Of course, we could have split the ‘Small Cap’ term into two separate terms – one selecting for spread and the other for market cap. As the combined expression isn’t very complicated, it saves space to do them as one and it allowed us to introduce you to the idea of a composite selection and the notion of nested expressions.

Trading Universe

All that remains now is to define the Trading Universe, which supplies the shares selected by the ‘Small Cap’ list.

  1. Click the Exit Wizard button to return to the Trading Specification Dialog, then click the Back To Shared button to move back up to the Shared level of the Trading Spec dialog, where the Trading Universe tab is located. Click the Trading Universe tab button
The Trading Universe tab is optionally used to prefilter the base list of shares that List Selectors can select from

The settings here provide a way of pre-filtering the securities in the ShareScope list, before your list selectors pick shares from it. It’s use is optional, as your selectors can select shares directly from ShareScope’s lists. However, we recommend its use, as it can accelerate back-test times by reducing the number of securities that your list selectors have to deal with.

  1. Ensure the settings you have are as shown above and please take a moment to look at how the filters are defined using checkmarks. If you change the source ShareScope list then you must click the Update Filter Criteria to update the filters displayed in each filter dialog.

Well Done!

You’ve got through the hardest part of the tutorial. You’ve now mastered the Trading Specification Dialog and DEfT Wizard. Along with the key RuleTrader concepts you’ve learnt, that’s a big part of your journey towards mastering RuleTrader and creating your own high performance automated investment system. It’s time now to create some trading rules for our trading strategy using RuleTrader’s unique AutoTrend feature

Scroll to Top