Being overbought does not mean sell!

Being overbought does not mean sell!

Since the recovery from the lows in December 2018 the market has been \"overbought\" - which isn't necessarily a bad thing.

As the S&P500 index recovered from its Christmas 2018 lows I began to see comments about the index being overbought, as measured by the Relative Strength Index oscillator, or RSI (not to be confused with relative strength against an index). Typically, an RSI measurement over 70 is deemed ‘overbought’, and below 30 is ‘oversold’ but because it’s a measure of momentum being overbought should not trigger a sell signal (and likewise oversold should not trigger a buy).

The S&P/ASX 200 index ($XJO) in Australia experienced something similar last month. The 14-day RSI crossed above 70 on February 5th following when it broke above resistance at 5900. But since then the momentum has taken it a further 4% - and three more crosses of RSI above 70:

A&P/ASX 200 Index A&P/ASX 200 Index

So if you had sold on that first overbought signal you would have missed out on that subsequent rally!

Taking it to the stock level

Is there an easy way to identify those stocks whose RSI(14) has crossed above or below a certain level multiple times to identify strong positive or negative momentum?

Of course! The Optuma Scripting Language can be used to calculate custom tools and timecounts, and highlight bars when certain conditions occur.

Below is a chart of MSFT with the RSI(14) overbought level set to 66 and the oversold to 33. Why these levels rather than the standard 70 and 30? No particular reason, but I wanted to see if it worked better than the default settings in showing the strength and weakness earlier, but there’s no reason you can’t keep it at 70 and 30, or try 60 and 40, or 70 and 50.

The red Show Bar arrows indicate where the RSI(14) has crossed above 66 (overbought), and the green ones when it crossed below 33 (oversold):

MSFT with the RSI(14) MSFT with the RSI(14)

Since July 2016 when MSFT’s RSI crossed above 66, it crossed above another 23 times until it finally reached oversold levels in October 2018 - 613 trading days since it was previously oversold. These values are calculated in the panels below the price chart using the following formulas in Show View panels:

Days Since Oversold

1
2
V1 = RSI(BARS=14) < 33;
TIMESINCESIGNAL(V1)

Number of times Overbought since last Oversold

1
2
3
4
5
//Create 2 Boolean conditions
V1 = RSI(BARS=14) CrossesAbove 66;  
V2 = RSI(BARS=14) CrossesBelow 33;  
//Count the number of times V1 occurred since V2
COUNTMATCHSINCESIGNAL(V1,V2)

The COUNTMATCHSINCESIGNAL() function requires two true/false Boolean scripts, and counts the number of times V1 has occurred since V2

Displaying the statistics in a watchlist

The above is a useful look at individual charts, but we can now use the formulas in a sortable watchlist to filter a universe and quickly find opportunities or see where a particular stock sits compared to others.

Here’s a watchlist of the S&P500 companies (with the same RSI(14) and 33/66 levels as the MSFT chart above) sorted by the number of overbought conditions since the last time it was oversold (the #O/B Since O/S column).

As you can see ORLY is ranked top with 15 occasions in the last 407 trading days since it was last oversold.

Watch List RSI Layout Watch List RSI Layout

The first column O/B Since O/S gives a true/false result depending on if the RSI has been in overbought territory more recently than it was oversold. This uses the SWITCH() function as follows:

1
SWITCH(RSI(BARS=14)>66, RSI(BARS=14)<33)

The last two columns shows the current RSI value and whether it is above the 45-day moving average. So whilst ORLY is top of the list its RSI is now in the 50s and below its long-term moving average, so you may want to keep an eye on the chart to see if this short-term weakness turns into something bigger.

ORLY Overbought Oversold Chart ORLY Overbought Oversold Chart

Negative Momentum

To look at those stocks with negative momentum click on the column you wish to sort by, so in this example COF hasn’t been overbought for 280 days, during which time it has crossed into oversold territory 7 times.

Watch List RSI Layout Watch List RSI Layout

Copying the Watchlist Data to Excel

If you wish to carry out further analysis in Excel then simply right-click on the watchlist and select Copy CSV Values to Clipboard from Actions, and then paste in to Excel (note that you may need to click on the Text to Columns option under the Data menu in Excel to format the data).

Also, Enterprise Services clients can send a watchlist dynamically to Excel under the Actions > Send To menu - this is particularly useful when linked to a realtime data provider as the values in Excel will automatically update when the watchlist updates in Optuma.

Example Workbooks

Optuma clients with access to our ASX or US end-of-day data can download an example of the above watchlist and charts. Click the buttons below to save an open the workbook and experiment with the formulas as you wish. Don’t forget to post any questions on the Scripting Forum, or contact us to arrange a consulting session.