Genetic algorithm for trading signal generation
Genetic algorithms GA are well suited tools to answer that question. Before I proceed the usual reminder: What I present in this post is just a toy example and not an invitation to invest. The general process follows the steps below:. From a trading perspective GA are very useful because they are good at dealing with highly nonlinear problems.
However they exhibit some nasty features that are worth mentioning:. There are several R packages dealing with GA, I chose to use the most common one: The in sample period goes from January to December The Out of sample period starts on January The logic is as following: The equity market exhibits two main characteristics that are familiar to anyone with some trading experience.
Long term momentum and short term reversal. Those features can be translated in term of technical indicators by: This represents a set of 4 parameters: The sets of parameters are the chromosomes. The other key element is the fitness function. We might want to use something like: In what follows, I chose to maximise the Sharpe ratio. Before commenting the above results, I want to explain a few important points. To match the logic defined above, I bounded the parameters to make genetic algorithm for trading signal generation the look-back period for the long term moving average is always longer that the shorter moving average.
I also constrained the optimiser to choose only the solutions with more than 50 trades in the in sample period e. Overall the out of sample genetic algorithm for trading signal generation are far from impressive. The returns are low even if the number of trades is small to make the outcome really significant. This post is intended to give the reader the tools to properly use GA in a quantitative trading framework.
A few potential improvement to explore would be:. The code used in this post genetic algorithm for trading signal generation available on a Gist repository. The problem with using such approaches: Taleb is mostly right, in that policy changes e. Thank you for reaching out. The choice of the fitness function is really up to you and it depends on what you try to achieve. It might be a minimum return, stability of return, minimise genetic algorithm for trading signal generation, minimum correlation with other strategies etc….
However some functions might be biased. Policies will forever drive data, just as data will drive policies. It is a vice-versa world in the financial industry…even so much more for traders, investors and bankers. Thank you for reaching out and sorry for the late answer. I just use common sense in the selection of parameters and above all I tend to use as much as possible the same set of parameters accross all instruments traded. May I genetic algorithm for trading signal generation this article into Chinese and post it on my blog?
I will let you know the link and remain your name on it. I really hope genetic algorithm for trading signal generation, this article can help more people. As long as you clearly mention the source me and put a link to the original article in translated article, I have no problem with the post being translated into Chinese.
Thank you very much for posting this! U have just provided me a valuable source for me. I have used the Algorithm written by you and obatained the following results. Sun Jan 24 Option is only provided for backward compatibility of the API. Stopped because hard maximum generation limit was hit. Could u please explain what can we interpret in the solution and my Objective is to predict the future value and how it can be interpreted from this case.
Your optimal solution is: You can easily relax this assumption should you want to explore different solutions. My objective is to predict the future value that is like if i give input till 27th jan i should get prediction ofr the next date like for 28th. Can we do this with the methodology u have used. You only have to adjust the frequency of your data. My example used weekly data but you can use the exact same genetic algorithm for trading signal generation with daily data.
Obviously the variables to use will probably have to be adjusted as well. Thank you for the wonderful post. I have been so excited to go through your codes. I am a newbie. Can you genetic algorithm for trading signal generation let me know how can i interpret the readings viz.
Mail will not be published required. March 14, at 2: Reply to this comment. March 15, at 8: The R Trader says: March 16, at 7: April 16, at 1: June 23, at July 12, at Yichen Zhang, CFA says: September 10, at 2: September 10, at 9: December 28, at 7: January 24, at 7: January 24, at 8: January 27, at 8: January 28, at 8: March 29, at Leave a Reply Click here to cancel reply.
Powered by WordPress and Fluid Blue theme.