Harnessing Machine Learning for Stock Price Prediction with Random Forest and Simple Moving Average Techniques
By Ir. ARIF MUDI PRIYATNO S.T., M.Kom
30 Jul 2024
Harnessing Machine Learning for Stock Price Prediction with Random Forest and Simple Moving Average Techniques
This paper explores the application of machine learning in predicting stock price trends, specifically for PT Bank Central Asia Tbk (BBCA) shares, using the Random Forest Regression model and Simple Moving Average (SMA) techniques. The SMA parameters ranged from 3 to 200 days, aiding in forecasting the price trends as either rising, sideway, or declining. To achieve accurate and generalizable predictions, the data normalization process was implemented using the MinMax scaler. The methodological framework adopted a time series cross-validation (CV) approach, executed 10 times with a future test window of 40 days, ensuring the robustness and reliability of the predictive model. The model's performance was systematically evaluated based on metrics of accuracy, recall, precision, and F1-score. Results from the cross-validation series indicated varied performance, with the most notable achievements in the 9th and 10th iterations, where both demonstrated an F1-score surpassing 0.745 and 0.808 respectively, and similar levels of accuracy and recall at 0.825. These high F1-scores signify a strong harmonic balance between precision and recall, underscoring the model's capability to effectively predict the stock price movements of BBCA. The findings affirm the potential of utilizing advanced machine learning techniques like Random Forest in conjunction with SMA indicators to enhance the predictability of stock market trends, offering valuable insights for investors and financial analysts.