Member-only story

Technical Analysis-Infused Machine Learning

Utilizing Machine Learning to Predict the Relative Strength Index

--

Forecasting market returns using machine learning models can be daunting. This can push us to find opportunities elsewhere, such as trying to forecast price derivatives or other indicators that exhibit less noise.

This article will show how to code a linear regression algorithm that forecasts the changes in the relative strength index, which helps to forecast market returns indirectly.

The Relative Strength Index

The relative strength index (RSI) is a momentum oscillator and a popular technical indicator used in financial analysis, particularly in the context of stock trading and investment. RSI provides insights into the strength and speed of price movements in a financial asset, helping traders and investors make informed decisions. The RSI is a numerical value that ranges from 0 to 100 and is typically displayed as a line on a chart.

It is generally calculated over a 14-period time frame by default, but this can be adjusted to match the trader’s or analyst’s preferences. Traders use RSI to generate buy and sell signals. For example, a common strategy is to buy when RSI crosses above 30 (indicating potential undervaluation) and sell when RSI crosses below 70 (indicating potential overvaluation).

The following chart shows an example of a 14-period RSI calculated on EURUSD’s daily prices.

14-period RSI of EURUSD

Creating the Linear Regression Algorithm

The main objective is to use EURUSD’s 14-period RSI as an example and to create an algorithm that forecasts at every time step, the future value. For this, we will make sure of its stationarity by taking the differences in the RSI, which simply means that we will try to design an algorithm that predicts whether the RSI will go up or down. This information can be very useful due to the very high correlation between the market return and the return of its RSI. But before coding the algorithm, let’s quickly discuss linear regression.

--

--

Sofien Kaabar, CFA
Sofien Kaabar, CFA

Written by Sofien Kaabar, CFA

Top writer in Finance, Investing, Business | Trader & Author | Bookstore: https://sofienkaabar.myshopify.com/

No responses yet