Essential Trading Techniques — The RSI Moving Average Cross
Presenting the RSI Moving Average Cross Trading Technique in TradingView
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.
The Fibonacci Trading Book is finally out! Filled with Fibonacci-based trading methods (tools, indicators, patterns, and strategies), this book will guide you through improving your trading and analysis by incorporating an important technical analysis approach that is Fibonacci. (Link to pay in PayPal for the PDF version at the end of the article)
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. 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.
For a detailed and thorough collection of contrarian trading strategies, you can check out my book. The book features a huge number of classic and modern techniques as it dwelves into the realm of technical analysis with different trading strategies. The book comes with its own GitHub.
Contrarian Trading Strategies in Python
Amazon.com: Contrarian Trading Strategies in Python: 9798434008075: Kaabar, Sofien: Booksamzn.to
The RSI-MAC Technique
Crossovers refer to a market that surpasses or breaks its moving average (which is also called a signal line). Generally, when a time series surpasses its moving average, it may be sign that it’s going to continue higher while if it breaks its moving average, it may be a sign that it’s going to continue lower. The trading conditions for the RSI moving average cross (MAC) technique are as follows:
A bullish signal is detected whenever the RSI is below 25 and surpasses its 5-period signal line.
A bearish signal is detected whenever the RSI is above 75 and breaks its 5-period signal line.
A picture is worth a thousand words. The following Figure shows a bullish signal based on the technique:
The following Figure shows a bearish signal based on the technique:
The code in Pine Script (TradingView’s coding language) is as follows:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sofien-Kaabar
//@version=5
indicator("RSI Technique - MA Crossover", overlay = true)
lookback = input(defval = 8, title = 'Lookback')
rsi = ta.rsi(close, lookback)
rsi_signal = ta.sma(rsi, 5)
bullish_signal = rsi > rsi_signal and rsi[1] < rsi_signal[1] and rsi < 25
bearish_signal = rsi < rsi_signal and rsi[1] > rsi_signal[1] and rsi > 75
plotshape(bullish_signal, style = shape.triangleup, color = color.blue, location = location.belowbar, size = size.small)
plotshape(bearish_signal, style = shape.triangledown, color = color.orange, location = location.abovebar, size = size.small)
The following Figure shows a few signals based on the technique:
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:
As you may also notice, during severe trends, the technique does not work as expected.