Dec 032011

Here is a rough idea of what I have planned for upcoming posts. I intend to start by developing a very simple stock market trading system from scratch, implemented in Python. It will have the following components:

  • Accessing free historical data from Yahoo and Google (daily and intraday!)
  • Storing and retrieving the data in files using a common format
  • Simple indicators from scratch (such as moving averages, atr, etc.)
  • A very simple trading system that has various order types and accounts for slippage
  • Simple trading system logs and statistics (%wins/losses, drawdown, expectancy, etc.)
  • A Python interface to a complete indicator package (TA-LIB)

After the basic system is developed, I will demonstrate how to implement very simple Genetic Algorithms and Neural Networks and use them to optimize trading systems. While discussing Genetic Algorithms, I will cover many different fitness functions that can be used to test if the algorithms are getting the answers they should be.

I will then explore some topics that are extremely interesting to me at the moment: Genetic Programming and Gene Expression Programming. These techniques can be used to automatically discover new trading systems, new indicators, or to do time series prediction. I think you will be amazed by how powerful these algorithms are and how simple it can be to implement them.

There are a number of other things that I may touch on including: Analyzing market breadth, the Forex market, various forms of 2d and 3d visualization, book reviews, interesting academic papers, or anything else market related. Obviously, I have a wide range of interests, and I tend to get bored easily. So please bear with me.

As always, any and all feedback will be appreciated.

Dec 032011

Welcome to my latest project! In this blog I intend to create a series of posts and tutorials on some of my favorite subjects: Trading Systems, Intelligent Algorithms, and Visualization. I have been programming computers for over 30 years (anyone remember the VIC-20?) and am obsessed with learning the latest technologies and applying them to what interests me.

I fully realize that there are many excellent existing projects out there that cover the topics I plan on covering, and I have learned much from them. However, I believe in order to fully understand something, you must do it yourself from scratch. I also believe in simplicity. Many projects are extremely large and complex and have teams of people developing them. While there is certainly a need for projects such as those, it can be extremely difficult to learn about the fundamentals of a topic from such a code base.

Therefore, the code I will be posting (to paraphrase Einstein) will be as simple as possible, but not simpler. It is intended to be short, easy to understand, and a starting point for your own customization’s and explorations. It will represent just one of many ways to accomplish the same task. Of course, I am also very interested in any feedback, bug fixes, or improvements that you may have.

While the code I write may look simple, it is a function of the tools I use. These days there are many very high quality programming languages and utilities that can do an enormous amount of work in very little code. When someone writes a trading system from scratch, the result will be very different when implemented in C vs. Python. I prefer to use to the best tool for the job at hand, so you will see a variety of languages and tools used. Currently, Python is my favorite general purpose language, although Ruby is a close second. All of the languages and utilities I use are free, open source, and run on multiple platforms (at least OSX, Linux, and Windows). Most code will work with a default installation. However, sometimes a library may need to be installed. I will note when that is necessary.

One last note. While I strive to write simple code, I am going to focus on the algorithms involved and will assume that my readers have at least a basic knowledge of computer programming. If you are completely new to programming, there are many other excellent tutorials out there to get you started. Google is your friend.