extended periods, and effectively model non-linear
relationships between variables.
The proposed LSTM-based approach provides:
• Superior prediction accuracy by learning
patterns that span longer timeframes.
• Better handling of non-linearity and
volatility present in financial markets.
• Memory cells and gating mechanisms that
prevent vanishing gradient problems,
common in traditional RNNs.
• Reduction of prediction errors as
demonstrated by lower Mean Squared Error
(MSE) and higher R-Squared (R²) values
compared to Linear Regression and Moving
Average.
By adopting LSTM, the system achieves a more
reliable and efficient stock price prediction model,
suitable for practical financial decision-making.
5 METHODOLOGY
5.1 Moving Average
A typical stock indicator in technical analysis is the
moving average. By producing a continuously
updated average price, the moving average of a stock
is calculated to in smoothing out the price data and
enabling rice data and enable analysts to see trends
and patterns. The moving average generates a
smoothed line that where represents the mean price
across a defined time frame. Traders and analysts use
it to identify stock market trends. For example, When
the present market value exceeds the moving average,
it may signal an ascending trend, whereas a price
falling below the moving average could indicate a
descending trend. Additionally, many traders utilize
the intersection of various moving averages as a
method to generate trading cues. For instance, the
intersection of a brief-term moving average rising
above an extended-term moving average might be
interpreted as a positive market signal, potentially
indicating a favourable moment for investment.
𝑀𝐴 =
∑
(1)
The limitations of this moving average are lagging
indicators because they are based on historical price
data, sensitivity to timeframes as different timeframes
can produce varying moving average results, rely on
price data and do not take into account other critical
factors that influence the stock market, such as
fundamental analysis, news events, economic indica
tors, and investor sentiment, in volatile or choppy
markets with frequent price fluctuations and no clear
trend that may generate false or conflicting signals,
These calculations rely on past data, which may not
accurately represent present or upcoming market
trends.
5.2 Linear Regression
Linear regression is a statistical technique commonly
used for stock market predictions. It involves fitting a
straight line to historical price data to estimate future
price movements. Linear regression is a relatively
simple and straightforward statistical technique. It is
easy to understand and implement, making it
accessible to both beginners and experienced
analysts. It provides interpretable results. This model
is trained and applied quickly, allowing for rapid
analysis and prediction. Linear regression can help
identify relevant independent variables that influence
stock price movements. By examining the
coefficients, analysts can determine which variables
have a significant impact on the target variable, aiding
in feature selection and model refinement.
𝑦 = 𝛽0 + 𝛽1𝑥1 + 𝛽2𝑥2 +··· +𝛽𝑛𝑥𝑛 (2)
The target variable and the independent variables
are assumed to have a linear relationship using linear
regression. However, stock market data often exhibits
nonlinear patterns and complexities, which may limit
the accuracy of predictions using linear regression
alone. To enhance predictions, additional techniques
such as polynomial regression, time series analysis,
or machine learning algorithms can be employed to
capture nonlinear relationships and incorporate more
sophisticated modelling approaches.
5.3 LSTM
The purpose of LSTMs is to capture long-term
dependencies and patterns in sequential data. Unlike
moving averages and linear regression, which do not
inherently consider the sequential nature of the data,
LSTMs can learn from the historical sequence of
stock prices and capture complex temporal
relationships. Stock price movements often exhibit
nonlinear patterns, which can be challenging to
capture with linear regression. LSTMs, with their
ability to model complex nonlinear relationships, can
capture the intricate dynamics of the stock market by
leveraging the memory cells and gating mechanisms
within the LSTM architecture. Moving averages and
linear regression often rely on a limited set of