Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

A Very Interesting RSI Trading


Strategy
Presenting the V-RSI Trading Technique in
TradingView
Sofien Kaabar, CFA

This article is based on a new series of studies that showcase a few


trading techniques based on the RSI. A trading technique is a way to use
an indicator. The study is based on Pine Script, TradingView’s coding
language.

A Gentle Introduction to the RSI


The RSI stands for Relative Strength Index, a technical analysis indicator
used to measure the strength and momentum of a security, such as a
stock, currency, or commodity. The RSI is calculated using mathematical
formulas and plotted on a graph to visually represent the level of strength
or weakness of a security over a given period.

The RSI is based on the principle that as prices rise, the security becomes
overbought, and as prices fall, the security becomes oversold. The RSI
helps traders to identify potential trend reversals or price corrections.

The RSI calculation involves comparing the average gain of the security
over a given period to the average loss of the security over the same
period. The default version of the RSI is then plotted on a scale of 0 to
100, with readings above 70 considered overbought, and readings below
30 considered oversold. The RSI is a popular indicator among traders
because it can provide early warning signals of potential market trends.

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 1 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

For example, if the RSI of a security is consistently rising and reaches a


level above 70, it could indicate that the security is overbought and due
for a correction. On the other hand, if the RSI is consistently falling and
reaches a level below 30, it could indicate that the security is oversold and
due for a bounce-back.

It’s worth noting that the RSI should not be used in isolation as a sole
basis for making trading decisions. Traders typically use the RSI in
conjunction with other technical analysis tools and market indicators to
gain a more comprehensive understanding of the market conditions and
make informed trading decisions. Generally, the RSI is calculated over a
rolling period of 14.

14-period RSI

Pre-order my new book with O’Reilly Media, Deep Learning for Finance
now on Amazon! In today’s fast-paced financial landscape, staying ahead
of the game is essential. With the fusion of deep learning and finance,
time series analysis will become second nature to you! Algorithms are
covered from A-Z and range from simple linear regression to complex
LSTM architectures, and even temporal convolutional neural networks! A
dedicated GitHub repository is provided.

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 2 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

Deep Learning for Finance: Creating Machine &


Deep Learning Models for Trading in Python
Deep Learning for Finance: Creating Machine & Deep
Learning Models for Trading in Python [Kaabar, Sofien]
on…

The V-RSI Trading Technique


From its name, the V-RSI trading technique is a simple method to predict a
complete reversal based on the pattern detected on the indicator. The V-
technique occurs when the RSI shapes a V or an inverted V around the
oversold and overbought levels, thus showing that the market is ready for
reversal. The trading conditions for the default version are as follows:

A bullish signal is detected whenever the 8-period RSI surpases


15 when the previous RSI is below 15 and the prior RSI is above
15.
A bearish signal is detected whenever the 8-period RSI breaks
85 when the previous RSI is above 85 and the prior RSI is below
85.

The following Figure shows a few signals based on the V-technique:

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 3 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

Signal chart

The code in Pine Script (TradinView’s coding language) is as follows:

// This source code is subject to the terms of the Mozilla Public Lic
// © Sofien-Kaabar

//@version=5
indicator("RSI Technique - V", overlay = true)
lookback = input(defval = 8, title = 'Lookback')

rsi = ta.rsi(close, lookback)

bullish_signal = rsi > 20 and rsi[1] < 20 and rsi[2] > 20


bearish_signal = rsi < 80 and rsi[1] > 80 and rsi[2] < 80

plotshape(bullish_signal, style = shape.triangleup, color = color.


plotshape(bearish_signal, style = shape.triangledown, color = color.

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 4 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

The following Figure shows a few signals based on the V-technique:

Signal chart

Of course, not all techniques are perfect. You are bound to encounter a
few bad signals, especially during trending periods as illustrated by the
following Figure:

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 5 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

Signal chart

You can tighten the conditions a bit by adding the following:

A bullish signal is detected whenever the 8-period RSI surpases


15 when the previous RSI is below 15 and the prior RSI is above
15. At the same time, the current RSI must be below the RSI from
two periods ago.
A bearish signal is detected whenever the 8-period RSI breaks
85 when the previous RSI is above 85 and the prior RSI is below
85. At the same time, the current RSI must be above the RSI
from two periods ago.

The following shows tightened signals:

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 6 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

Signal chart

Of course, tightening may also remove good signals. Take a look at the
same chart with no tightening:

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 7 of 8
A Very Interesting RSI Trading Strategy | by Sofien Kaabar, CFA | Jan, 2024 | Medium 14/1/2024, 12:55 AM

Signal chart

https://kaabar-sofien.medium.com/a-very-interesting-rsi-trading-strategy-448ce9d36899 Page 8 of 8

You might also like