How to create a custom technical ranking system
In your studies you may have come across the ‘weight of evidence’ approach to investing which looks at prices and various indicators to help identify potential trading opportunities. Let’s say that as a momentum investor you look for opportunities by studying the price relationship to various moving averages, the positive or negative slope of the moving average, the RSI value, and the rate of change. You could save the indicators to a Page Layout and apply it to hundreds of charts and manually plough through them to visualise those that look good – or bad – whilst jotting the tickers down as you go, but that takes time – not to mention a toll on your eyes!
Another solution would be to use the Optuma scripting language to do all the work for you. By assigning values to certain technical conditions you can create your own technical weight of evidence methodology – or custom ranking system.
Here are five indicators that you may look for to determine whether further analysis should be undertaken:
- the price relationship to moving averages, eg is the current price above the 50MA?
- the slope of a moving average, eg is the 13EMA sloping up?
- the value of two moving averages, eg is the 33MA greater than the 88MA?
- RSI values, eg RSI(10) is above its 10MA
- positive recent gains, eg rate of change over last 3 months is positive.
NOTE: these have been chosen as an example only and should not be used in your analysis without further study.
By default, when a true/false condition is calculated by Optuma a true result is given a value of one, and zero if false. So if we build a formula containing those five conditions above and sum the results we will be able to easily see those stocks where all the conditions are true (the total will be five), where all are false (0), and everything else in between. Note that we won’t know which of the five conditions are true, just the overall number. However, we can adjust the values for each condition so those that you deem more important can have a higher weighting – more on that in a follow up article.
Here are the five true/false conditions based on the list above that can be added to a custom watchlist column. Remember when starting a line with // that the text that follows is ignored, allowing you to add comments or descriptions:
//Currently trading above the MA50?
V1 = CLOSE()> MA(BARS=50, CALC=Close);
//The 13EMA is sloping up?
V2 = MA(BARS=13, STYLE=Exponential, CALC=Close) IsUp;
//Is the MA33 is above MA88?
V3 = MA(BARS=33, CALC=Close) > MA(BARS=88, CALC=Close);
//Is the RSI(10) above its 10MA?
V4 = RSI(BARS=10) > MA(RSI(BARS=10), BARS=10);
//Positive returns over last 3 months?
V5 = ROC(Month(PERIODAMOUNT=1), BARS=3) > 0;
//Sum the results to get a ranking value
The last line calculates the sum of the results to display a value, so that the stocks where all five conditions are true will have a ranking value of five, whilst those scoring zero will obviously have no true results. In the example on the right a custom column has been added to a watchlist of the ASX200 with the above example ranking formula being used. This column can be sorted, grouped, and also displayed with a custom label and colour. As you can see in the snippet of the watchlist, BSL, BWP, and CAR have a ranking of five, whilst BOQ, BXB and CBA are all zeroes.
Creating a Time Series
Once the column has been added to the watchlist then a time series of the ranking value can then be added to a chart by clicking on the column heading and dragging it on to the chart to display it in a new view (tip: once added right-click on the line and change the Plot Style to Shaded Step).
Custom Bar Colours
Using the same ranking example you can also assign specific bar colours for each value. For example, those bars that have a ranking value of zero are bright red, ones are maroon, twos are pink, etc.
To do this right-click on any bar and change the colour scheme to Custom and then create a formula for each value with the colour as required.
TIP: if you save the original script and give it a name, it can then be referenced by other formulas using the SCRIPT() function.
All that needs to be changed for each colour is the value, so for red bars denoting a rank of zero use the following, remembering to use the double equals sign (==) to denote equality (single equals signs are used to assign variables).
//Get the original saved script, called MyRank;
The next colour for those with a ranking of 1 would have ==1, and so on.
Once all the colours have been added the chart would look like this:
Clients subscribed to ASX or US data can click the buttons below to save and open the workbook examples.
Let us know what you think, and feel free to post your scripts or queries on the client forum.
Darren Hawkins, MSTA
Senior Software Specialist at Optuma
Darren is the senior Software Specialist at Optuma. He joined the company in 2009 after attending an introductory technical analysis course. Darren now instructs users all over the world, from experienced Wall Street traders and professional money managers to individual traders drawing their first trendlines.
Darren grew up in the UK and attended college in the USA where he earned a BA in Economics from St Mary's College of Maryland. He went on to spend a few years working at the Nasdaq Stock Market in Washington DC. Going on to live and work in Australia, the US and currently the UK, Darren has a broad understanding of the individual needs of traders, portfolio managers and investors utilising a wide range of methodologies.
In 2014 Darren passed the UK-based Society of Technical Analysts diploma course, and when not looking at charts he keeps a keen eye on England's cricket team - especially if they are playing against Australia. He lives in the Essex countryside in England, with wife Wendy and their labrador, Gabba.