Skip to main content

DEHypGpOls: a genetic programming with evolutionary hyperparameter optimization and its application for stock market trend prediction


Stock markets are a popular kind of financial markets because of the possibility of bringing high revenues to their investors. To reduce risk factors for investors, intelligent and automated stock market forecast tools are developed by using computational intelligence techniques. This study presents a hyperparameter optimal genetic programming-based forecast model generation algorithm for a-day-ahead prediction of stock market index trends. To obtain an optimal forecast model from the modeling dataset, a differential evolution (DE) algorithm is employed to optimize hyperparameters of the genetic programming orthogonal least square (GpOls) algorithm. Thus, evolution of GpOls agents within the hyperparameter search space enables adaptation of the GpOls algorithm for the modeling dataset. This evolutionary hyperparameter optimization technique can enhance the data-driven modeling performance of the GpOls algorithm and allow the optimal autotuning of user-defined parameters. In the current study, the proposed DE-based hyper-GpOls (DEHypGpOls) algorithm is used to generate forecaster models for prediction of a-day-ahead trend prediction for the Istanbul Stock Exchange 100 (ISE100) and the Borsa Istanbul 100 (BIST100) indexes. In this experimental study, daily trend data from ISE100 and BIST100 and seven other international stock markets are used to generate a-day-ahead trend forecaster models. Experimental studies on 4 different time slots of stock market index datasets demonstrated that the forecast models of the DEHypGpOls algorithm could provide 57.87% average accuracy in buy–sell recommendations. The market investment simulations with these datasets showed that daily investments to the ISE100 and BIST100 indexes according to buy or sell signals of the forecast model of DEHypGpOls could provide 4.8% more average income compared to the average income of a long-term investment strategy.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15

Data availability

Enquiries about data availability should be directed to the authors.


Download references


This study didn’t receive any funding.

Author information

Authors and Affiliations



All authors contributed to the study conception and design. The analysis and code were done by DA and BBA. The first draft of the manuscript was written and then polished by DA and BBA. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Davut Ari.

Ethics declarations

Conflict of interest

The authors declare that they have no conflict of interest.

Ethical approval

This article does not contain any studies with human participants or animals performed by any of the authors.

Informed consent

Informed consent was obtained from all individual participants included in the study.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.



To implement stock exchange market investment simulation, the daily trend of stock index is expressed by considering 24 h nominal return rate as.

$$ trend_{n} = \frac{{(I_{n} - I_{n - 1} )}}{{I_{n - 1} }}, $$

where \(I_{n - 1}\) is the previous closing time index and \(I_{n}\) is the current closing time index. (The daily trend data in BIST100 datasets were generated according to this formulation) Then, when the total capital is invested for an stock market index, the daily change in total capital (\(C_{n}\)) with respect to the daily trend of the stock index is calculated as

$$ \Delta C_{n} = trend_{n} C_{n - 1} $$

Then, the current total capital is updated by adding daily change in total capital (\(\Delta C_{n}\)) to previous total capital as

$$ C_{n} \leftarrow C_{n - 1} + \Delta C_{n} = C_{n - 1} + trend_{n} C_{n - 1} $$

This recursive relation estimates the current total capital. When the total capital is kept in currency (no investment in the stock market), the total capital in currency does not change depending on the daily trend of the stock index.

$$ C_{n} \leftarrow C_{n - 1} $$

When an investor preference is limited to choosing one of these two states (the stock index investment for \(s_{n} = 1\) and the currency investment for \(s_{n} = 0\)) in the market, the current total capital can be updated as

$$ C_{n} \leftarrow \left\{ {\begin{array}{*{20}c} {C_{n - 1} + trend_{n} C_{n - 1} } & {s_{n} = 1} \\ {C_{n - 1} } & {s_{n} = 0} \\ \end{array} } \right\} $$

A trade commission (stock trading fee), which is charged per buying or selling operation, is applied as

$$ C_{n} \leftarrow (1 - T_{f} )C_{n} , $$

where \(T_{f}\) is the commission rate per the operation.

A pseudocode for the market investment simulation is given, bellow:

figure a

Rights and permissions

Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Ari, D., Alagoz, B.B. DEHypGpOls: a genetic programming with evolutionary hyperparameter optimization and its application for stock market trend prediction. Soft Comput 27, 2553–2574 (2023).

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:


  • Genetic programming
  • Stock market prediction
  • Stock price
  • Hyperparameter optimization
  • Trend prediction