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 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. RSI is displayed on a line graph moving (oscillating) between two extremes. Most traders show 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 understand 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, rapidly moves up. The price often reverts to the mean as traders try 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_n1

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 =(2+2+2+2+2+2+2+2)/14 = 1.14

AvgDown = (1+1+1+1+1+1)/14 = 0.43

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

RS = AvgUp/AvgDown = 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 – ((100 / (1 + RS)) = 100 – ((100/ (1 + 2.65)) = 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 helpful 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.

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

Additionally, the RSI becomes almost meaningless when significant news events impact 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 market context — 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 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 how you may want to incorporate RSI into your trading strategies.

RSI Trading Strategies

Many traders will trade strictly 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 afterward, 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 security trends upwards, and RSI also trends upwards, this is RSI convergence, as seen below.

When RSI converges with a trend, this is considered to confirm 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 bearish and bullish signals is generally more helpful when the RSI period is 14 days. 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 the oversold or overbought territory, and the indicator diverges from the price action. When RSI fails to confirm the trend, 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. A 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.

You can see a bullish RSI divergence in action in the chart below. 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 minor 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 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 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.

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 with 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 incorporate meaningful new information.

In other words, I don’t think it’s wise to execute a trade based on overbought or oversold conditions blindly. Instead, understand the market context. Additionally, RSI’s signals are typically most reliable when used 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 indicates 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, improving the likelihood of trade success.

RSI Trading Strategies that Work

I will discuss two RSI trading strategies that work and the rationale behind why they do.

RSI Blue Sky Buy

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 apparent.

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

RSI Strategy Backtests

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. In the second test, we’ll still buy five sectors, 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 Without RSI Filter

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.

Equities Strategy Without RSI Filter

Equities Strategy With RSI Filter

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)

        self.add_timer(
            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] ]
        weight = 1 / len(buys)


        # 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
        for d in buys:
            self.order_target_percent(d, target=weight)


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

# Add Benchmark data
benchmark = get_prices([BENCHMARK_TICKER], START_DATE, END_DATE)
benchdata = bt.feeds.PandasData(dataname=benchmark.droplevel(level=0),
                                name='S&P 500',
                                plot=False)
print(f"Adding Benchmark {BENCHMARK_TICKER}.")
cerebro.adddata(benchdata)

# Add sector data
sector_tickers = get_sector_tickers()
sector_prices = get_prices(sector_tickers, START_DATE, END_DATE)
for ticker, data in sector_prices.groupby(level=0):
    print(f"Adding sector ticker {ticker}.")
    d = bt.feeds.PandasData(dataname=data.droplevel(level=0),
                            name=ticker,
                            plot=False)
    cerebro.adddata(d)

# Add strategy
cerebro.addstrategy(Strategy)

# Add observers
cerebro.addobserver(bt.observers.Benchmark,
                    data=benchdata,
                    _doprenext=True,
                    timeframe=bt.TimeFrame.NoTimeFrame)

# Add analyzers
cerebro.addanalyzer(bt.analyzers.Returns, _name='strategy')
cerebro.addanalyzer(bt.analyzers.SharpeRatio, riskfreerate=0.02)

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

# Run the strategy
cerebro.run()

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

cerebro.plot()

The Bottom Line

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

Leave a Comment