![]() |
| Tutorial 16 - Data Mining price and moving average crosses |
|
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.
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.
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:
Let’s create these using ShareScope’s data mining wizard:
This criterion will now be added to the filter bar. However, it is not complete yet. First we will create the second criterion.
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.
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.
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.
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.
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:
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 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.
|