It is difficult to predict index values or stock prices with a single financial formula. They are affected by many factors, such as political conditions, global economy, unexpected events, market anomalies, and the characteristics of the relevant companies, and many computer science techniques are being used to make more accurate predictions about them. This study aimed to predict the values of the XKAGT index by using the monthly closing values of the Borsa Istanbul (BIST) Forestry, Paper and Printing (XKAGT) index between 2002 and 2023, and the machine learning techniques artificial neural networks (ANN), random forest (RF), k-nearest neighbor (KNN), and gradient boosting machine (GBM). Furthermore, the performances of four machine learning techniques were compared. Factors affecting stock prices are generally classified as macroeconomic and microeconomic factors. As a result of examining the studies on determining the macroeconomic factors affecting the stock markets, 10 macroeconomic factors were determined as input. The macroeconomic variables used were crude oil price, exchange rate of USD/TRY, dollar index, BIST100 index, gold price, money supply (M2), S&P 500 index, US 10-year bond interest, export-import coverage rate in the forest products sector, and deposits interest rate. It was determined that all machine learning techniques used in the study performed successfully in predicting the index value, but the k-nearest neighbor algorithm showed the best performance with R2=0.996, RMSE=71.36, and a MAE of 40.8. Therefore, in line with the current variables, investors can make analyzes using any of the ANN, RF, KNN, and GBM techniques to predict the future index value, which will lead them to accurate results. [ABSTRACT FROM AUTHOR]