Genetic algorithm stock market

By: Hamer On: 05.07.2017

This problem, called security analysis, involves determining which securities ought to be bought in order to realize a good return on investment in the future. That is, we evolved decision trees capable of classifying those stocks according to whether they should be bought or sold short.

During the study we evolved two types of security analysis decision trees. The first used only indicators from fundamental analysis and the second used only indicators from technical analysis.

Fundamental analysis is a method of evaluating a security to measure its intrinsic value by examining related economic, financial and other qualitative and quantitative factors.

The R Trader » Blog Archive » Using Genetic Algorithms in Quantitative Trading

Technical analysis is a method of evaluating securities by analyzing statistics generated by market activity. A strategy for security analysis, regardless of whether it uses technical or fundamental indicators, will consist of a number of rules for making investment decisions. That strategy can be represented as a decision tree where the terminal nodes represent investment decisions and the functional nodes represent rules based either on technical or fundamental indicators.

Due to this fact, many existing investment strategies are represented in the form of decision trees. In total forty two different indicators were selected and used from both Technical analysis and Fundamental analysis. The evolved strategies were for a fixed holding period either three months, six months, nine months or twelve months long. The decision trees were then back-tested using market data from to Genetic Programming is a specialization of a Genetic Algorithm. Genetic Algorithms are population based, meaning that they operate within a population consisting of many different individuals.

Each individual is represented by a unique genotype usually encoded as a vector. These operators, when combined, produce what computer scientists refer to as a Genetic Algorithm.

The three operators of a Genetic Algorithm being applied to a population of vectors blocks. The difference between a Genetic Algorithm and the Genetic Programming Algorithm is the way in which individual genotypes are represented.

In Genetic Algorithms genotypes are represented either as Strings or as Vectors whereas in Genetic Programming these genotypes are represented using tree data structures.

The crossover operation on tree structures can happen in a few ways, either a sub-tree is swapped out, a leaf node is remove or changed, or the values of some node are adjusted. An illustration of this is shown below,. This diagram depicts the crossover strategy of a decision tree used by genetic programming for security analysis. After this study we concluded that Genetic Programming has great potential to evolve new strategies for security analysis and investment management provided that better functions for calculating fitness can be derived.

Throughout our research study we saw that decision trees evolved using Genetic Programming were able to produce stock classifications that beat the average market return consistently over all four quarters. This is true for decision trees that used technical indicators as well as decision trees that used fundamental indicators. Two independent research reports were produced by myself and my friend. Both reports go into much more detail about our research study, the approach taken, our design and implementation, the testing strategies we used, our conclusions and recommendations for further research.

You can also download a copy of the source code created during the implementation.

Genetic Algorithm as a Tool for Stock Market Modelling

For my colleagues more technical account of the project please click here. The write up is gorgeous as well. I only had a chance to glance at the report.

Some statistics that would be good to look at: As it turns out, it can be surprisingly hard to beat an equally weighted portfolio. Rebalance the portfolios quarterly, since some stocks will go up and some will go down e. If your genetic algorithm beats these portfolios then you have "alpha" excess return over the benchmark.

Of course alpha is not everything. You should look at the Expected Tail Loss ETL also known as CVaR, Expected Shortfall for both the GA portfolio and the "benchmark". If you have less risk for the same return then you can consider that you beat the benchmark. The ETL measure is a better measure than the Sharpe ratio when it comes to risk, since the Sharpe ratio measures variance, which is two sided.

ETL only measures loss.

GA - Trading System Example1 (S&P500 - daily)

It is difficult to determine why they make the "choices" they do. Your GA or NN starts performing poorly. What steps can you take to address this? Of course with a decision tree its not quite so bad, since at least you know what decisions it made. In our approach we only compared the performance of the stock selections made by our decision trees against an equally weighted portfolio. Extending our research to incorporate different portfolios is an interesting idea that we will follow up on during the next phase of development.

We are also considering implementing some of the well known approaches for security analysis to be used as additional performance benchmarks. If you or anyone else have suggestions on which approaches might make good benchmarks, please let me know. Your comments about using other performance measures is spot on. We would definitely like to re look at the back-testing framework and investigate ways of making it more rigorous and less prone to over-fitting. We would also like to implement additional fitness functions that take into consideration measures of portfolio risk as well as measures of excess return alpha.

I will look into the measures you mentioned and see how best we can incorporate them into our existing framework. We will also be considering how it might be possible to use an open source back-testing framework such as ZipLine, the back-testing framework used by quantopian. The challenge of making these algorithms more transparent and, quite frankly, a little bit less scary, is one not to be taken lightly.

My colleague is currently working on a research assignment where he is attempting to lift the veil on some of the inner workings of Neural Networks. He is considering using a real world financial application of Neural Networks in his research. So if you have any ideas about that, please let me know?

Personally speaking, I am currently working on a research assignment where I am attempting to construct an algorithmic framework for carry trade portfolio selection and optimization. It makes use of a few Computational Intelligence algorithms and going forward I will keep in mind the issues you have mentioned.

I will try and identify ways of mitigating or eliminating those concerns in the framework. Thanks again for all your comments, we appreciate the feedback. If you have any more good ideas, please contact us. This is discussed at: I understand the approach because the concept of backtesting an algorithm against a random trading strategy is conceptually similar to testing a search algorithm against random search.

Which is something I have done before. How popular would you say that backtesting strategy is? But it has to start somewhere. We debated our approach and an external opinion would be much appreciated. We limited our test sample to just one sector because of two reasons:.

It seems it does the same just very inefficiently and probably with less accuracy too. Hi Ignas, to be perfectly honest GP suffers from many drawbacks and the technique is still being perfected.

That having been said, traditional decision tree induction methods which I am more recently a fan of also have their drawbacks which may or may not be overcome by Genetic Programming. Hi Lawrence, unfortunately not. This post is quite a number of years old and represents an old varsity project of mine: I would recommend taking a look at Genotick for an unbiased genetic programming based trading strategy. I believe people are trading it live.

Sign me up for updates from this blog! Quantocracy is the best quantitative finance blog aggregator with links to new analysis posted every day.

We use machine learning to try and beat the market. Turing Finance June 17, Hide Navigation Code Experiments Stochastic Models R4nd0m GitHub About This Site Turing Finance Stuart Reid Contact Suggestion Box.

Artificial Intelligence Computational Finance. Genetic Programming in Finance project Performance of security analysis decision trees vs. Relationship between the size of the decision tree to the fitness Most popular indicators used in the final decision tree Average tree sizes per iteration Example Security Analysis Decision Tree Example Security Analysis Decision Tree. Tags Artificial Intelligence Computational Finance Genetic Programming. Share on Facebook Tweet This Share on Google Plus Pin This Email This.

Previous Story Clustering using Ant Colony Optimization Next Story Intelligent Algorithmic Trading Systems. June 5, Reply. June 6, Reply. June 10, Reply. June 11, Reply. We limited our test sample to just one sector because of two reasons: June 29, Reply. April 27, Reply. May 1, Reply. April 24, Reply. Hi Stewart, I am trying re implement the GA in python. What are some python libraries you would recommend.

May 9, Reply. Stuart, Have you tried to trade your system live? Turing Finance Mailing List For email updates when I post a new article.

Friends of Turing Finance Quantocracy is the best quantitative finance blog aggregator with links to new analysis posted every day. Turing Finance on Twitter My Tweets. Turing Finance on Facebook. Most Popular Posts 10 misconceptions about Neural Networks Regression analysis using Python Hacking the Random Walk Hypothesis Random walks down Wall Street, Stochastic Processes in Python Stock Market Prices Do Not Follow Random Walks Algorithmic Trading System Architecture How to be a Quant.

Most Recent Posts Testing the Random Walk Hypothesis with R, Part One The Promise of Computing Lossless Compression Algorithms and Market Efficiency?

Popular Tags Agent-based Computational Economics Agent Based Model Algorithmic Trading Algorithmic Trading Systems Ant Colony Optimization Artificial Intelligence Computational Economics Computational Finance Computational Investing Correlation Analysis Economic Forecasting Neural Network Efficient Market Hypothesis Genetic Programming Machine Learning Neural network particle swarm optimization Portfolio optimization Quantitative Methods Randomness Tests Random Walk Hypothesis Regression Analysis RStats Self Organizing Map Stochastic Process Swarm Intelligence.

Disclaimer This is a personal blog. As such the opinions expressed here are my own and do not necessarily represent those of my employer. Furthermore, all information on this blog is for educational purposes and is not intended to provide financial advice.

genetic algorithm stock market
Rating 4,9 stars - 852 reviews
inserted by FC2 system