INTERNATIONAL JOURNAL OF RESEARCH AND INNOVATION IN SOCIAL SCIENCE (IJRISS)
ISSN No. 2454-6186 | DOI: 10.47772/IJRISS | Volume IX Issue X October 2025
Page 6760
www.rsisinternational.org
Gold Price Forecasting in Kuala Pilah, Negeri Sembilan, Malaysia
Using Long Short-Term Memory (LSTM)
Mohamad Hafiz Khairuddin, Nurazian Binti Mior Dahalan, Zamlina Binti Abdullah, Azlin Binti
Dahlan, Nur Aryuni Allysha Binti Hasnan
Faculty of Computer and Mathematical Sciences, Universiti Teknologi MARA (UiTM) Cawangan
Melaka Kampus Jasin, 77300 Merlimau, Melaka
DOI: https://dx.doi.org/10.47772/IJRISS.2025.910000552
Received: 27 October 2025; Accepted: 02 November 2025; Published: 18 November 2025
ABSTRACT
Gold is the most popular investment in the world because it has proven to be the most effective haven in many
countries. It is challenging to use technical analysis to predict gold's value. Many prediction problems
involving time components require time series forecasting, an important topic in machine learning. This
paperpresents a prototype for predicting the gold price in Kuala Pilah, Negeri Sembilan, Malaysia, using the
Long Short-Term Memory (LSTM) time-series method. To address the problem, a dataset of daily gold prices
was collected from Telegram Kedai Emas Nur Jannah and the Bullion Rates website. The main feature of the
system is to predict the gold price and to visualise the predicted value. The waterfall method has been chosen
as the project's methodology to ensure the project’s flow is correct. The predictive model was also evaluated
using Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error
(MAPE). As a result, the system achieved an MAE of 0.108 at the daily time scale. The RMSE was 0.131 at
the daily time scale, and the MAPE was 17%. The system can also improve the visualisation to make it more
interactive and include another timescale, such as a daily timeframe.
Keywords: Gold, Prediction, Long Short-Term Memory (LSTM), Time Series
INTRODUCTION
The gold price prediction system in Kuala Pilah, Malaysia, is an interesting area of research because the gold
price here is unpredictable. The reason for this is that the price in Kuala Pilah, Negeri Sembilan, Malaysia is a
factory price, which differs from the MS Bullion website. Predicting gold prices can be a gold mine —very
beneficial for investors, traders, and anyone who needs to plan ahead. The price of gold is constantly changing
and it cannot be easily predicted. Now that prices are rising, many customers who come to this shop are
interested in selling their gold. However, some exchange old gold for new designs to use the gold as savings
and a 'backup' to cash savings (Assan, 2023). This project aims to analyse the factors influencing gold prices in
Kuala Pilah and to develop a reliable model for predicting future price trends. Understanding the dynamics of
the gold market in this specific geographical location will enhance existing knowledge and provide practical
implications for stakeholders involved in gold trading in Kuala Pilah. This is because the gold price in Kuala
Pilah is the lowest in Malaysia. People prefer to buy gold here (Kuala Pilah) because of the low prices, which
are not tied to associations, and the reasonable wages, depending on the chosen design (Hamzah, 2021). The
low price of gold for decades has made gold shops in the town of Kuala Pilah, here, too often the frequent
focus of customers, especially every month and at weekends (Hasbi, 2023).
Problem Statement
There is a lack of accurate, reliable gold price predictions, which hinders individuals and businesses from
making informed decisions about buying, selling, and investing in gold. However, the price of gold fluctuates
unpredictably (Makala et. al, 2021). Current gold price prediction methods in Kuala Pilah are limited and often
unreliable, leading to uncertainties and potential financial losses for those involved in gold-related activities.
To address this problem, machine learning and deep learning methods, specifically recurrent neural networks
INTERNATIONAL JOURNAL OF RESEARCH AND INNOVATION IN SOCIAL SCIENCE (IJRISS)
ISSN No. 2454-6186 | DOI: 10.47772/IJRISS | Volume IX Issue X October 2025
Page 6761
www.rsisinternational.org
(RNNs) and Long Short-Term Memory (LSTMs), can be used to predict future gold prices. A comprehensive
and data-driven approach must be implemented, utilising historical gold price data to develop an accurate
predictive model for gold prices in Kuala Pilah.
Additionally, the problem at hand is the need for daily gold price predictions to identify optimal buying and
selling opportunities, ensuring purchases are made at lower prices and sales at higher prices (Setyowibowo et
al., 2022). This requires a solution that can accurately predict daily gold price movements. One possible
solution is to employ machine learning algorithms, such as RNNs, which are specifically designed to handle
time-series data. Training an RNN model on historical gold price data enables it to learn patterns and trends,
enabling reliable predictions of future prices. The model can then be utilised daily to forecast gold prices,
allowing traders and investors to time their buying and selling decisions to maximise profits strategically.
Regularly updating the model with the latest data ensures that predictions remain accurate and relevant.
Related Work
In predictive applications, LSTMs are particularly valuable for their ability to learn from historical data and
identify complex temporal patterns. For instance, in financial forecasting, an LSTM model can analyse past
stock prices to predict future values, capturing intricate dependencies that traditional models like ARIMA may
overlook (Zhang, 2003). LSTM architecture allows it to effectively manage sequences with long-term
dependencies, a crucial feature for predicting outcomes in which earlier inputs significantly influence future
outputs. This makes LSTMs particularly suitable for tasks such as weather forecasting, where current
conditions are influenced by historical climatic patterns (Greff et al., 2017).
Implementing LSTM for prediction involves structuring data into appropriate input-output pairs, where the
model is trained to map sequences of past observations to future values. After training, the LSTM can generate
predictions by processing the most recent data points. The model's performance is typically evaluated using
metrics such as Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE) to assess accuracy and
reliability (Brownlee, 2017). This robust framework enables LSTMs to achieve significant improvements in
prediction accuracy, making them a powerful tool for handling complex time-series prediction tasks.
Equation
The accuracy test determines whether the model performs well. This test utilised three methods to evaluate the
model's performance: Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and Mean Absolute
Percentage Error (MAPE). Accuracy testing validates the results produced by the developed model using the
formulas MAE, RMSE, and MAPE shown in Figure 1.
Fig 1. Equation Formula for Accuracy Testing
Model
In the gold price prediction system, a function named define_model was created to define the LSTM model.
The model was designed to accept input data with shape (128, 1), corresponding to 128 time steps with one
feature each. The model’s architecture consisted of three LSTM layers, each with 64 units. The
return_sequences=true parameter in the first two LSTM layers ensured that the entire sequence of outputs was
INTERNATIONAL JOURNAL OF RESEARCH AND INNOVATION IN SOCIAL SCIENCE (IJRISS)
ISSN No. 2454-6186 | DOI: 10.47772/IJRISS | Volume IX Issue X October 2025
Page 6762
www.rsisinternational.org
returned, enabling sequence predictions. After each LSTM layer, a Dropout layer with a rate of 0.2 was added
to prevent overfitting.
The final layer of the model was another Dense layer with a single unit, serving as the model's output and
predicting the future gold price. The model was compiled using the Nadam optimiser and mean squared error
as the loss function, both of which are suitable for a regression problem like this one. The model.summary()
function was called to print the model architecture. The function define_model then returned the constructed
model. Figure 2 shows the code for the LSTM model.
Fig 2. The Coding for the LTSM Model
METHODOLOGY
This phase involved tasks such as Research Design, Use Case Diagram, and Flow Chart.
Research Design
The process begins by collecting daily gold price data from Telegram Kedai Emas Nur Jannah for Kuala Pilah
and from the Bullion Rates website for Malaysia. The telegram displays the price of gold with wages, without
wages, and the trade-in price. It is cheaper than the price in the rest of Malaysia. This is because most gold
shops in Kuala Pilah use factory-set gold prices. Next, data cleaning and preprocessing steps are performed to
prepare the data for the LSTM model. This process includes handling missing values and transforming the data
into sequences for the model. The LSTM model, a type of neural network designed for time series data, is
trained on these sequences to learn historical price patterns. Finally, the trained model can be used to forecast
future gold prices by feeding it new sequences of past prices, as shown in Figure 3.
Fig3. Research Design Flow
INTERNATIONAL JOURNAL OF RESEARCH AND INNOVATION IN SOCIAL SCIENCE (IJRISS)
ISSN No. 2454-6186 | DOI: 10.47772/IJRISS | Volume IX Issue X October 2025
Page 6763
www.rsisinternational.org
Use Case
Figure 4 displays the use case diagram for this prototype, summarising the details of the prediction system and
the users involved. The admin user is responsible for adding daily gold prices from the Kuala Pilah datasets.
Fig 4. Use Case Diagram
Flow Chart
Figure 5 shows the flow chart of the prediction system. The homepage will provide the users with various
options for navigating the system.
Fig 5. Flow Chart
INTERNATIONAL JOURNAL OF RESEARCH AND INNOVATION IN SOCIAL SCIENCE (IJRISS)
ISSN No. 2454-6186 | DOI: 10.47772/IJRISS | Volume IX Issue X October 2025
Page 6764
www.rsisinternational.org
RESULT
Absolute errors and squared errors are the most widely used scale-dependent metrics, including mean square
error, root mean square error, mean absolute error, mean absolute percentage error, and median absolute error.
However, RMSE, MSE, and MAPE are the most popular because of their theoretical relevance in statistical
modelling (Hyndman, 2006). Table I presents the results for this prototype.
Table I Accuracy Testing Result
Model of gold
Mean Absolute
Error (MAE)
Root Mean Square
Error (RMSE)
Mean Absolute
Percentage Error (%)
Daily
0.108
0.131
15
Table I shows that the MAE is 0.108, the RMSE is 0.131, and the MAPE is 15%. These are acceptable results,
and 82.9% was achieved, which is viable for the LSTM model. The system's functionality was also tested
using six test cases during this functionality testing. Table II summarises the test cases completed during this
phase. Also, the functionality testing was successful, and the system is now functioning correctly and running
as planned. This is one of the functionalities tested.
Table II Functionality Testing
CONCLUSION
In conclusion, Gold Predict is a system that provides a time-series prediction model using Long Short-Term
Memory (LSTM). It predicts the daily gold price in Kuala Pilah at the daily time frame. The predicted values
are listed in a table, and they are visualised in a line chart to help investors understand future trends in gold
prices. The system also provides links to gold shops in Kuala Pilah, including their websites, for users who
want to shop directly on the website, learn more, or obtain more information about the shops. Lastly, it
includes a feature that lets users contact the admin directly to ask questions or request an explanation of our
website. The system also helps the admin by providing visualisation of each model, along with its accuracy.
For future work on this project, the gold price data should be pulled directly from financial websites by using a
gold API. This recommendation will help improve the model’s performance and enhance system features.
Another recommendation is to enhance the predictive model by using more advanced techniques,
incorporating additional features, and gathering more historical data to improve accuracy. Regular evaluation
and retraining will help maintain the model's performance. These steps will make the data analysis process
more efficient and the predictions more reliable.
INTERNATIONAL JOURNAL OF RESEARCH AND INNOVATION IN SOCIAL SCIENCE (IJRISS)
ISSN No. 2454-6186 | DOI: 10.47772/IJRISS | Volume IX Issue X October 2025
Page 6765
www.rsisinternational.org
REFERENCES
1. Assan, N. (2023, April 7). Makin ramai jual emas, harga cecah RM291 segram. Sinar Harian.
2. Brownlee, J. (2017). Long short-term memory networks with Python. Machine Learning Mastery.
3. Hamzah, N. A. (2021, March 7). ‘Lubuk emas di Pekan Kuala Pilah. Kosmo.
https://www.kosmo.com.my/2021/03/07/lubuk-emas-di-pekan-kuala-pilah/
4. Hasbi, A. (2023, May 25). Polis jumpa pengusaha lubuk emas Kuala Pilah. Harian Metro.
https://www.hmetro.com.my/mutakhir/2023/05/970614/polis-jumpa-pengusaha-lubuk-emas-kuala-
pilah
5. Hyndman, R. J., & Koehler, A. B. (2006, October). Another look at measures of forecast accuracy.
International Journal of Forecasting, 22(4), 679–688. https://doi.org/10.1016/j.ijforecast.2006.03.001
6. Greff, K., Srivastava, R. K., Koutnik, J., Steunebrink, B. R., & Schmidhuber, J. (2017, October).
LSTM: A search space odyssey. IEEE Transactions on Neural Networks and Learning Systems, 28(10),
2222–2232. https://doi.org/10.1109/TNNLS.2016.2582924
7. Makala, D., & Li, Z. (2021, February). Prediction of gold price with ARIMA and SVM. Journal of
Physics: Conference Series, 1767(1), 012022. https://doi.org/10.1088/1742-6596/1767/1/012022
8. Setyowibowo, S., As’ad, M., Sujito, S., & Farida, E. (2022, February). Forecasting of daily gold price
using ARIMA-GARCH hybrid model. JEP, 19(2), 257–270.
9. Zhang, G. P. (2003, January). Time series forecasting using a hybrid ARIMA and neural network
model. Neurocomputing, 50, 159–175. https://doi.org/10.1016/S0925-2312(01)00702-0