My struggles in understanding and learning about Object Oriented design, and the tools and knowledge I've taken from them.

Tuesday, March 1, 2011

Stock Predictor C# Utility

This blog references an application and source code.

To download this application, Click Here

To download the source, Click Here

Evidently, some people buy and sell securities on markets in the attempt to make money. These folks are called traders, and everyone is looking for the next big strategy to estimate what a particular security (also called Stock) is going to do in the future.

I'm not particularly interested in this, but a friend of mine brought up a method many traders use to predict when it is time to buy or sell a stock. The strategy involves looking at the current stock price, and comparing it to its 200-day moving average. When the stock price is below the 200 day moving average, has a history of being above its 200 day moving average, and is on an upward trend, that is a good indication that it might be time to buy.

When some version of the converse is true (stock is above the 200 day average, has a history of being below the 200 day moving average, and is on a downward trend), then it's time to sell.

Below is a screenshot of the utility I built



I'm not an active trader, and I know very little about how this whole capitalism thing works, but I know how to build an application that can represent this paradigm. I built this in C# Winforms. So, that's what I did.

I used the ZedGraph library to build a graph for me, and I built some logic around some of the concepts.

A few warnings:
1. I use Yahoo's stock history to grab prices. Usage of this tool may or may not violate Yahoo's terms of use agreement.
2. I make no guarantees about the correctness of the data derived from this tool, and this tool in no way constitutes a recommendation of a security transaction.
3. The code quality of this tool is not as high as it could be. It was sort of a rush job, because I didn't have much time to work on it before I had to start working on my next project.

I hope someone can use this little tool and get some value out of it. Or, if you decide to improve on it, let me know, and I'll post any fixes you make.

1 comment:

Stephen Hueners said...

Have you had a chance to check your code against the newly release code (http://code.google.com/p/npoi/)?

I'm hitting problems getting the Worksheet to resolve.

thx

Followers

Search This Blog

Powered by Blogger.