# Relative Strength Index (RSI): An Ultimate Guide

The relative strength index (RSI) is a technical analysis momentum oscillator that indicates potentially overbought and oversold conditions based on the magnitude of an asset’s recent closing price changes over a trading period. The RSI oscillates between zero and 100 and is considered overbought when above 70 and oversold when below 30.

RSI is one of the most popular technical indicators and is worth taking the time to understand. I’ll cover everything you need to know to understand and trade using the RSI in this post.

## What is the Relative Strength Index?

We’ll begin our guide with a basic introduction to the Relative Strength Index (RSI).

Traders have been using RSI for over 40 years, ever since J. Welles Wilder Jr. first introduced RSI in 1978 in his book, New Concepts in Technical Trading Systems. Since then, RSI has become one of the essential tools for traders of all types.

RSI is a momentum oscillator. This means that RSI is displayed on a line graph moving (oscillating) between two extremes. Most traders display the RSI below the price chart. This way, you can easily see both the RSI and the price action and how they compare. See the example of a price chart with RSI displayed below.

Let’s first gain a conceptual understanding of the relative strength index and then solidify that understanding by reviewing the math.

## What the RSI Means

RSI is conveyed as a number between zero and a hundred. When RSI is above 70, it is considered overbought. When the RSI is below 30, it’s regarded as oversold.

When an asset is overbought, there is a lot more buying than selling for the period. When there’s a lot of buying, the RSI, and typically the price, move up rapidly. The price often reverts to the mean as traders are trying to capture a quick profit due to the recent run-up, especially when there is no news driving the price higher.

The opposite is also true. If the price drops suddenly, traders looking for an opportunity to buy the asset now have their chance – especially when there is no apparent substantial news flow or event moving the prices lower.

## The RSI Formula

There are four steps when calculating the RSI. We’ll stick with conventional 14-period RSI. These periods could be longer in duration, such as monthly periods or even as short as five-minute periods.

In the first step, we calculate the bar-to-bar changes of each close.

$change = close_n- close_{n-1}$

Next, we have to smooth our price changes. We’ll use a simple moving average or SMA; however, exponential and Wilder’s Smoothing Method are also other popular methods.

If we have 14 periods, where eight of the changes are up 2%, and six are down 1%, occurring in any order, the AvgUp and AvgDown would be:

$AvgUp =\frac{2+2+2+2+2+2+2+2}{14} = 1.14$ $AvgDown = \frac{1+1+1+1+1+1}{14} = 0.43$

Step three is to calculate the relative strength (RS).

$RS = \frac{AvgUp}{AvgDown} = \frac{1.14}{0.43} = 2.65$

Our final step converts the RS, which theoretically could be infinity, into an oscillator between 1 and 100:

$RSI = 100 - \Big[ \frac{100}{1 + RS} \Big] = 100 - \Big[ \frac{100}{1 + 2.65} \Big] = 72.6$

An RSI of 72.6 would put us into overbought territory.

## What is a Good RSI Number?

There is no point at which the RSI of a security or asset is “good” or “bad”. Instead, interpreting the RSI depends on what you’re looking to accomplish, the current security trend, the market regime, and numerous other factors.

Still, the RSI does indicate some useful information about a security’s price action, but let’s dive a bit deeper into how to interpret RSI numbers beyond this basic level.

While the general rule of thumb for RSI is that over 70 is considered overbought, and under 30 is considered oversold, there are other factors to keep in mind, as well.

For example, bull and bear markets have a big impact on RSI. During a bull market, RSI numbers tend to be higher and stay overbought for longer periods. This makes sense since buying pressure is high during a bull market. Similarly, during a bear market, RSI numbers tend to be lower and may not bounce as quickly when oversold.

Additionally, the RSI becomes almost meaningless when large news events are impacting the stock or sector. Let’s look at TAN, which is a renewable energy solar ETF. The market is anticipating a Biden presidential win, and with that comes increased renewable energy spending. You can see that the RSI stays “overbought” for 13 days, as shown below.

This is the same for biotech companies getting FDA approval, mergers and acquisitions, and IPOs.

In other words, you have to take the RSI, and any other indicator for that matter, within the context of the market – prices don’t move in a vacuum.

## Is RSI a Good Indicator?

With the information above, you should now be able to answer if the RSI is a good indicator. The answer holds true for almost all indicators.

Yes, the RSI is a good indicator depending upon when and how it’s used. For me, it’s one of my favorite indicators. I use it extensively within my algorithmic trading strategies.

Let’s discuss a few ways you may want to incorporate RSI into your trading strategies.

Many traders will trade stricly based on overbought and oversold levels; however, that’s not the only way to trade the RSI. Some traders will use convergence, divergence, and swing rejection signals.

Let’s dig into these signals, and afterwards, I’ll discuss a few other RSI trading signals that are less well known and the rationale behind them.

### RSI Convergences

RSI convergence occurs when the RSI direction mirrors the price trend. For example, if the price of a security trends upwards, and RSI also trends upwards, this is RSI convergence, as seen below.

When RSI converges with a trend, this is considered a confirmation of that trend. Analysts typically take a converging RSI to mean that a trend is likely to continue in its current direction. RSI convergences also indicate the potential strength and speed of the trend. Convergences may occur with either upward or downward trends.

A trend confirmation providing a bullish signal generally occurs when the RSI goes from below 50 to above 50. A bearish trend confirmation occurs when the RSI drops from above 50 to below 50. Trend confirmation for both bearish and bullish signals are generally more useful when the RSI period is 14 days or more. Anything below 14 may be used but is typically considered less reliable for confirming trends.

### RSI Divergences

An RSI divergence occurs when the RSI enters oversold or overbought territory, and the indicator diverges from the price action. When this happens, RSI fails to confirm the trend, and traders should look for a trend reversal.

There is both bullish and bearish divergence.

A bullish divergence occurs when the price makes a new low, but the RSI makes a higher low. Bearish divergence occurs when the price makes a new high, but the RSI makes a lower high. Let’s make this clear with two examples.

In the chart below, you can see bullish RSI divergence in action. See Twilio’s RSI becoming oversold and trending up while price action in the same period is moving down. In this instance, the bullish divergence does lead to a small trend change that quickly resumes the downtrend.

Bearish divergence is the opposite. The RSI reaches overbought territory and trends down while the price is trending up. This divergence also leads to a short term trend change.

### RSI Swing Rejections

Swing rejections are a way to trade RSI divergence. Technical analysts consider a price trend to consist of consecutive higher highs and higher lows.

Please review Trend Following: The Definitive Guide if you’re not familiar with identifying price trends.

With that in mind, there are two types of RSI swing rejection - bullish swing rejections and bearish swing rejections. Bullish swing rejections occur at the point where the pattern of lower highs breaks. Bearish swing rejections happen where the sequence of higher lows breaks.

I’ve crafted up a fictitious RSI chart below to clarify this concept using a bullish RSI swing rejection.

To use a bearish example, put this into numbers, assume the RSI hits 27, rises to 29, then falls to 22. If it then rises above 29, it’ll be considered a failure swing, and that’s the point where a trader should act on the divergence.

## RSI Limitations

Indicators only ‘indicate’; they do not predict. And there’s no magic indicator that will let you know when to enter and exit a trade every time.

And while RSI is one of my favorite indicators, it has its limitations like any other indicator.

When a market is in a strong trend, RSI loses its usefulness. Additionally, RSI can remain overbought or oversold for long periods providing the trader misleading signals.

Being overbought or oversold for long periods isn’t a “bug”; it’s a feature. These levels make logical sense when the market or individual securities are incorporating meaningful new information.

In other words, I don’t think it’s wise to blindly execute a trade based on overbought or oversold conditions. Instead, understand the market context. Additionally, RSI’s signals are typically most reliable when used in conjunction with technical indicators that complement RSI.

The most frequent is the MACD.

## RSI vs. MACD

At this point, you may have noticed that RSI has a lot in common with another indicator: Moving Average Convergence Divergence (MACD).

The RSI aims to indicate whether an asset or market is overbought or oversold based on recent price changes. The MACD, on the other hand, measures the momentum of those price moves. This means that an asset could be overbought or oversold but still show positive momentum in that direction. When both indicators agree, confluence occurs, and it improves the likelihood of trade success.

## RSI Trading Strategies that Work

I’m going to discuss two RSI trading strategies that work and the rationale behind why they do.

The first strategy is to buy the first higher timeframe oversold condition in a blue sky breakout. Blue sky breakouts typically have very little resistance above existing price levels. You can watch for a five-minute trend change to improve the odds of success.

So what’s the rationale?

Good traders will wait for the first pullback before entering a long position – they won’t FOMO. This means there’s a high likelihood of the first 15-minute, hourly, and 4-hour oversold condition to bounce, assuming there is no news negatively impacting the stock. To improve the odds of success, look to make sure the market and the sector are moving up – you always want as much wind at your back as possible when trading.

### RSI Stack

The second strategy is an RSI stack. A bounce’s likelihood is higher if multiple timeframes indicate oversold or overbought conditions, especially on increased volume.

There are both psychological reasons and technical reasons for this. The psychological causes are apparent – people like to buy “bargains”. The technical reason is not as obvious.

When there is a flush down or up, the order book clears. This makes it much easier to a large move in the opposite direction.

## RSI Strategy Backtest Examples

Let’s create a simple sector momentum strategy. We’ll select the top five sectors by the rate of change over the last month. In the first test, we won’t filter by RSI. We’ll still buy five sectors in the second test, but we’ll remove any sector whose RSI is above 70.

As you’ll notice, this is a terrible trading strategy, but RSI filtering does improve the results.

### Sector Momentum With RSI Filter

Let’s look at a more sophisticated equities example where I filter overextended stocks where one component is the RSI. I’m not going to provide the code for this example as some of it is proprietary – but the sector code below is a great starting point for aspiring algorithmic traders.

## RSI Backtest Example Code

The code to the sector example above is below and on the Analyzing Alpha Github repo. You’ll need to modify where you get your price data from, but I discuss how to do this extensively in previous articles.

import backtrader as bt
from app.models.security import get_prices
from app.models.etf import get_sector_tickers

BENCHMARK_TICKER = '^GSPC'
START_DATE = '2010-01-01'
END_DATE = '2020-01-01'
USE_RSI_FILTER = True

class Strategy(bt.Strategy):
params = dict(
mom_period=20,
num_positions=5,
monthdays=[1],
monthcarry=True,
when=bt.timer.SESSION_START,
)

def __init__(self):
self.inds = {}
for d in self.datas:
self.inds[d] = {}
self.inds[d]['mom'] = bt.ind.ROC(d, period=self.p.mom_period, plot=False)
self.inds[d]['rsi'] = bt.ind.RSI(d, plot=False)

when=self.p.when,
monthdays=self.p.monthdays,
monthcarry=self.p.monthcarry
)

def notify_timer(self, timer, when, *args, **kwargs):
self.rebalance()

def rebalance(self):
ranked_sectors = []

for d in self.datas[1:]:
row = [d,
d.p.name,
self.inds[d]['mom'][0],
]
if USE_RSI_FILTER:
if self.inds[d]['rsi'][0] < 70:
ranked_sectors.append(row)
else:
ranked_sectors.append(row)

sectors = sorted(ranked_sectors, key=lambda x: x[2], reverse=True)

buys = [ s[0] for s in sectors[:self.p.num_positions] ]

# prepare quick lookup list of stocks currently holding a position
posdata = [d for d, pos in self.getpositions().items() if pos]

# remove those no longer top ranked
for d in (d for d in posdata if d not in buys):
self.close(d)

# rebalance those already top ranked and still there
for d in (d for d in posdata if d in buys):
self.order_target_percent(d, target=weight)

# issue a target order for the newly top securities
self.order_target_percent(d, target=weight)

# Create a cerebro instance
cerebro = bt.Cerebro(stdstats=True)

benchmark = get_prices([BENCHMARK_TICKER], START_DATE, END_DATE)
benchdata = bt.feeds.PandasData(dataname=benchmark.droplevel(level=0),
name='S&P 500',
plot=False)

sector_tickers = get_sector_tickers()
sector_prices = get_prices(sector_tickers, START_DATE, END_DATE)
for ticker, data in sector_prices.groupby(level=0):
d = bt.feeds.PandasData(dataname=data.droplevel(level=0),
name=ticker,
plot=False)

data=benchdata,
_doprenext=True,
timeframe=bt.TimeFrame.NoTimeFrame)

print(f'Starting Portfolio Value: {cerebro.broker.getvalue()}')

# Run the strategy
cerebro.run()

print(f'Ending Portfolio Value: {cerebro.broker.getvalue()}')

cerebro.plot()


## The Takeaway

There’s a reason why the RSI is such a popular technical indicator – it’s an incredibly useful tool. I use it extensively in my trading strategies and hope that this article’s information will help you use it in yours.

#### Leo Smigel

Based in Pittsburgh, Analyzing Alpha is a blog by Leo Smigel exploring what works in the markets.