RSI Trading Strategies (Backtest) – How The RSI Indicator Works

Last Updated on October 22, 2022

This article looks at how the RSI indicator works and how you can develop an RSI trading strategy. The Relative Strength Index (RSI) was developed by Welles Wilder and first introduced in a magazine called Commodities (now Futures) in June 1978. Wilder published a book in the same year called New Concepts In Technical Trading Systems (he also published the ADX indicator in the same book, an indicator we will cover later). The RSI has become one of the most widely used indicators for traders.

Our research indicates that RSI is one of the most useful indicators for trading strategies. However, it works best together with a second indicator or variable. Filters or additional criteria are needed in order for the RSI to be used in a trading strategy. The indicator works best on securities that are mean-reverting.

Most websites present the Relative Strength Index by using anecdotal evidence. But in order to find out if something really has any predictive value, you need to backtest. In this article, we show you how to use the RSI indicator.

We have backtested trading systems for over 20 years and we can confirm that the RSI works reasonably well on stocks and stock indices. As such, the RSI can be used in trading strategies that are mean-reverting, but only when you add some more criteria, variables, or filters.

If you find this article useful, you might want to have a look at our landing pages for a lot of other trading strategies and edges:

The Relative Strength Index formula

The RSI is an oscillator that measures the magnitude of both gains and losses over a period of n days. You decide the number of days, normally adjusted to the time frame of your analysis. The value of RSI can be a maximum of 100, and the minimum can be zero.

The values oscillate and a low value is regarded as more bullish than high readings. The main idea is to use it as an overbought or oversold indicator. Thus, RSI works only on assets that are mean-reverting.

The formula reads like this:

RSI = 100 – (100 / (1+RS))

RS = average of up closes of the last n days/average of down closes of the last n days

In practice it works like this for a fourteen-day period:

  1. Add the percentage gains on up days (from close to close). Divide the sum by 14.
  2. Add the percentage of down days (from close to close). Divide the sum by 14.
  3. Divide number one (the average up days) by number two (the average down days). This is the RS in the formula.
  4. Put RS (number three) into the formula above.

This is it. It’s of course cumbersome to do the calculations, but that’s why we have spreadsheets and trading platforms. All software packages have the RSI built into their charting, so there is no need to use this formula, except for understanding how it works.

How to interpret the RSI-formula

The RSI can be used in many ways, but this article briefly looks at the two most popular ways to use the indicator:

Overbought and/or oversold – mean-reverting strategies:

Because the RSI oscillates between 0 and 100, it is mostly used to pinpoint when the security is oversold or overbought. A low reading indicates it has fallen in price, and a high reading indicates it has risen and thus might signal it is overbought.

Here is an example of how a seven-day RSI oscillates:

Relative strength index (RSI) strategy
The RSI indicator oscillates between 0 and 100.

The indicator is in the lower pane and clearly shifts from oversold to overbought quite frequently.

Also, notice how the RSI gets oversold in a rising and trending market. This is because it’s a relative index – as the name of the indicator implies. It only measures the relative performance over the last n number of days. If those days have shown little volatility, then even small changes in the price make the RSI leap up or down.

What happens if a stock is oversold or overbought?

Trading is about odds and probabilities. It’s impossible to know if a trade will turn out good or bad if a stock is for example oversold. That’s why you need to backtest an indicator. Furthermore, it depends on the asset class you are testing. The Relative Strength Index works best on stocks and performs worse on other assets.

RSI divergence strategies:

Chart readers and technical analysts (we are not among them) believe a divergence between the price and the indicator is a strong signal. A divergence occurs like this:

  • Bullish divergence: when the price sets a new low, while the RSI doesn’t. This is a buy signal.
  • Bearish divergences: when the price sets a new high, while the RSI doesn’t. This is a sell signal.

Here are examples:

Relative strength index (RSI) settings
RSI divergence.

The problem with divergencies is that they are established after the fact. We can only spot divergencies in hindsight, which of course is not very useful. Additionally, they are harder to quantify and program into a useful code. Our experience is that this is a signal that serves little practical use for traders.

Which threshold settings should you use on the RSI strategies?

There are of course no common settings for which values offer the best thresholds. You need to tweak and test to see what has worked in the past and what hasn’t.

Just as the time frame can vary from asset class to asset class, the threshold numbers are dependent on the time frame, the trend of the instrument, and the responsiveness you want.

We have found out that short time frames work best for the RSI. This means we need to use more extreme values like for example 15 for oversold and 85 for overbought. If you use a time frame of ten days, you are less likely to see readings of 15 or less.

Thus, a typical buy signal occurs when the reading shows values of 15 or less. If the reading is above 85, it’s considered a bearish signal as the asset is overbought.

Perhaps needless to say, but the shorter the time frame, the more erratic the RSI. A longer time frame usually leads to smoother readings with less volatility of the RSI.

What is the best time frame for an RSI strategy?

There is of course no absolute answer to this. It all depends on the properties of the markets you are trading. For example, let’s test a short-term RSI and a long-term RSI strategy on the S&P 500.

The first example is a two-day RSI strategy where we buy when it crosses below 15 and sells when it crosses above 85. We get this equity curve:

Relative strength index (RSI) backtest
Buy when RSI(2) crosses below 15 and sell when it crosses above 85.

This simple RSI strategy performs just a tad worse than “buy and hold” from 1993 until November 2020. A 100 000 investment compounded to 861 000.

Considering the RSI strategy spends only 42% of the time invested, and additionally has less drawdown than “buy and hold” (33% vs. 55%), it shows how even simple strategies can perform well, even though we would modify and add variables. However, you must factor in that the test ignored commissions, slippage, and taxes.

Let’s switch to a long-term RSI of 10 days. A longer-term RSI means there are fewer extreme variations in RSI, and thus we lower our threshold limits: we buy below 30 and sell above 70. The equity curve reads like this:

Relative strength index (RSI) trading rules
A longer time frame produces less profits on the S&P 500 compared to a  two-day time frame.

A ten-day RSI strategy produces half the result compared to a two-day RSI, albeit spending about the same amount of time in the market. The drawdowns are bigger as well.

Where is the sweet spot? Our research indicates shorter time frames work best for the RSI (on stocks). We like to use a time frame lower than ten days, and the best result has come with two and three days. However, you need to work with backtesting yourself to find out what works and what doesn’t.

Combining different time frames on the RSI strategy

What happens if we use two RSIs?

Let’s assume you want to only enter positions in the underlying trend of the instrument. How do you define a trend? You can for example use a longer RSI to determine the longer trend, while you enter on short-term pullbacks. Combining long-term and short-term RSI can take this form:

The long-term 30-day RSI  must be above 50, and the two-day RSI must be below 15. If both conditions are met, then enter at the close. The exit is when the short-term RSI crosses above 85 (then exit at the close). On the S&P 500 we get this result:

RSI strategy backtest
By combining a long and short RSI the result doesn’t improve.

The result is worse than the original single-RSI formula. Part of this is explained by less exposure in the market: it’s reduced from 42 to 27%. However, the max drawdown is the same at 33%.

The above RSI strategy performed pretty well for almost 25 years until it started to crack in the second half of 2017. The biggest loss is a trade that enters on the 21st of February 2020 and exits on the 26th of March 2020 for a loss of 21.5%.

The code in Amibroker is like this:

Buy= RSI(30)>50 AND RSI(2)<15 ;
Sell= RSI(2)>85;
sellPrice=C ;

There are other twists you can make by combining a long and short RSI that improves the strategy, something we will get back to in a later article.

How do you trade stocks with RSI?

The RSI is a mean-reverting indicator and works best on stocks. As explained above, you need to test both the time frame and threshold settings yourself. And it doesn’t work on all stocks. Commodity-related stocks like miners, oil, and coal have historically not worked for mean-reverting strategies. Opposite, the more boring and less volatile the stock, the better RSI performs.

The best way to use RSI trading strategies

The best way to use RSI strategies is in combination with other tools. These tools can be volume, indicators, relative performance to other stocks or assets, or whatever ace you have up your sleeve.

What is the best indicator to use with RSI?

In stocks, RSI works really well with the Internal Bar Strength Indicator (IBS). You might want to combine IBS with some of these strategies, for example:

What is Connors RSI?

There exist many versions of the original RSI made by Welles Wilder. The most famous is probably Connors RSI developed by Larry Connors and his team at Trading Markets. We believe the formula serves much better as a marketing gimmick for Connors and his team than anything else. Nevertheless, the formula is the average of three parts:

  • Relative Strength Index (RSI)
  • Up/Down Length (Market Streak Value)
  • Rate of Change (ROC)

In addition to Connors RSI there are many others, like for example Cutler’s RSI.

What is Cutlers RSI?

Cutler’s RSI is a variation of the original RSI indicator developed by Welles Wilder. It uses a simple moving average in its calculation instead of the smoothed moving average used in Wilder’s original RSI formula.

Amibroker and backtesting

The above charts were done by using Amibroker. This is a good trading platform, and you can read our thoughts on this link:

FAQ about RSI

We end the article with some typical questions we receive per e-mail:

Is RSI a good trading strategy?

Yes, RSI is among the best indicators among mean revertive indicators. However, it’s not the best!

What is the best RSI setting for day trading?

Unfortunately, RSI works best on daily bars. We have backtested much data using intraday data, but it’s not particularly useful.

How do you trade with RSI?

First of all, we prefer using daily bars. Second, we prefer to use a short number of days in the setting, preferably max 5 days. Third, RSI works best on stocks and mean revertive assets that have an overnight edge. We have not been successful in forex.

Is RSI trading profitable?

Yes, RSI trading is profitable, but it requires backtesting. One size doesn’t fit all. Markets are different. You might also want to read our take on RSI(2) on QQQ.

What are the best settings for swing trading?

The best setting for swing trading is a short number of days for stocks, but this might vary in other markets. Also, as mentioned above, RSI works best for stock trading.

Can the RSI indicator also be used as a momentum indicator?

Yes, it can. However, the RSI momentum strategy we backtested in a previous article didn’t work on stocks. But no market is the same, because RSI works on crypto.

Can you use RSI on other bars than daily bars?

Yes, but our experience indicates that RSI works best on daily bars. Please have a look at our article called weekly RSI vs daily RSI – what is best?

Amibroker code for RSI

We have provided code and strategies for a lot of RSI strategies that you can find on our page for free and backtested trading strategies.

You might also want to have a look at our shop.

Currently, we have no python strategy code, pdf, or books about the RSI indicator.

Does RSI work? Conclusion

Yes, the RSI works on stocks and in many other asset classes. But you have to use it together with some other indicator(s) or variable(s). On its own, the RSI works, but by adding some kind of filter it can be improved a lot. An RSI trading strategy can come in many different forms!

Similar Posts