ShareScope Home
Training Zone Banner

Click here for a printable version of this tutorial.

 Tutorial 16 - Data Mining price and moving average crosses

Learn more with ShareScope's exclusive training CDs


Back to Training Zone

   

Many customers use data mining filters to identify instruments whose price has recently crossed above or below a moving average (see chart below) or where a shorter term moving average has crossed above or below a longer term moving average.

These filters only require two criteria. A third can also be added which we will cover at the end of the tutorial.

Arriva PLC

We’ll look here at creating a filter that identifies instruments whose price has crossed above a moving average.

Let’s take a specific example: we want to identify instruments whose price has crossed above its 200-day exponential moving average. This will be based on closing prices.

Let’s get a basic understanding of how the filter will do this: ShareScope will look for instruments where the price is above the moving average on the most recent trading day but was below the moving average on the previous trading day. That is, it has crossed the moving average.

Moving Average 1

So, if you run the filter in the evening after updating ShareScope, the most recent day will be the current day; if you run the filter the following morning, the most recent day will be yesterday.

These are the two criteria that we need to create:

  1. Price is above moving average on most recent day
  2. Price is below moving average on previous day

Let’s create these using ShareScope’s data mining wizard:

 Price above moving average on most recent day TOP
  1. Create a new filter and give it a name.
  2. Click on the Add Criterion button in the Data Mining screen. This should open the wizard. If instead it opens the Add criterion dialog, click on the Use wizard button in the bottom right corner.
  3. In Step 1 of the wizard process, select Volume and Technical Analysis.
  4. In Step 2, select Moving Average.
  5. In Step 3, select Moving Average minus price on date.
  6. In Step 4, set the date to 0 trading days ago. In ShareScope, the most recent data is day 0.
  7. In Step 5, select the type of moving average. For this example we would select Exponential and set the period to 200 days.
  8. In Step 6, select Absolute value and then click on Finish.

This criterion will now be added to the filter bar. However, it is not complete yet. First we will create the second criterion.

 Price below moving average on previous day TOP

Repeat the above process but this time, in Step 4 of the wizard process, set the date to 1 trading day ago.

You now have two criteria (M.A. -price 0td ago and M.A. –price 1td ago), both measuring the value of the 200 day exponential moving average minus the price but on different days.

Now the important part.

On the most recent day, we want the price to be above the moving average. If this is the case, the calculation of moving average minus price will result in a negative value. Therefore we want the criterion to identify only those instruments that return a negative value.

Moving Average 2

Notice the two values in each criterion box. These measure the range of values that the criterion will filter for: the lowest value on the left; the highest on the right. By default, ShareScope enters the entire range of values calculated for the instruments in the list.

Data Mining Dialog

In the criterion titled M.A. –price 0td ago, we want to filter for only negative values. You can leave the value on the left as this is already negative. Change the right hand value, however, to -0.01 (see example below). This ensures that only negative values will be included in the filter.

Data Mining Dialog

Likewise, on the previous day we wish the price to be below the moving average. Therefore, the calculation of moving average minus price will return a positive value. In this case, in the criterion titled M.A. –price 1td ago, you can leave the value on the right as this is already positive but you will need to change the value on the left to 0.01. You may prefer to set this to 0 which will include instruments whose price was touching the moving average on the previous day.

Data Mining Dialog

You should now have a shortlist of instruments that have just crossed their 200 day moving average.

To check this, select the first instrument in the list and press Enter to display the historical graph screen. You will need to make sure that you use a Graph setting which includes a 200 day exponential moving average.

Press Space bar to scan through the graphs of all the instruments in the list.

You can create different versions of this filter by changing the following components:

  • How many days ago the cross occurred (remember, the most recent day is 0 days ago)
  • The type of moving average used (e.g. 30 day simple moving average)
  • Price crossing below moving average (positive value on most recent day; negative value on previous day)

Filters that identify two moving averages crossing are constructed in a similar way. Here, you would select the Difference between two moving averages on date criterion during the wizard process.

ShareScope includes a filter which identifies golden crosses – a shorter term moving average crossing above a longer term moving average, which you can use to develop your own. You can copy filters.

 The third criterion TOP

The third criterion alluded to at the beginning of the tutorial can be used to ensure that the moving average being crossed is also on an upward path. For this, you would select the Moving Average change since date criterion during the wizard process and select since 1 trading day ago in the next step. When the criterion has been added, make sure you set the left hand value to 0.01 to search for positive changes (i.e. moving averages going up).

You may also find the following resources helpful:

Tutorial 6 – Basic Data Mining: a short video showing you the basics of data mining in ShareScope.

ShareScope’s Become an Expert at Data Mining training CD (Only £19.95): a 2-3 hour video tutorial on creating a wide range of data mining filters.

And, of course, you can call our Customer Support line who will be delighted to help you create your own filters.

From outside London: 0845 045 0111
From London: 020 7549 1104
Email: support@sharescope.co.uk

© 1997 - 2008 Ionic Information Ltd. Privacy Statement