/Evolutionary-Trading-Strategies

This code illustrates the use of genetic programming to evolve financial trading strategies for a single equity stock. Individuals (strategies) are considered as functions of historical price data, outputting a position allocation. Strategy fitness evaluation is computed by simulating the strategy over historical financial data. Because financial investment requires a fundamental tradeoff between risk and return, strategies are evaluated on multi-objective fitness functions depending on profit and maximum drawdown of the strategy and ranging from very risk-prone to very risk-averse. The population of individual strategies is evolved using tournament selection, single-point crossover, and random mutation as evolutionary operators. Strategies with the best fitness at any stage in the evolutionary process are recorded in a ‘hall-of-fame’. At the end of the evolutionary process, strategies in the ‘hall-of-fame’ are evaluated over a set of test data and selected based on a train-test criterion which penalizes strategies that do not generalize well.

Primary LanguagePython

Stargazers