Saturday, February 13, 2010

How to generate a list of stocks according to your own magic formula – Part Two

 
This is Part Two, Click here for Part one.

Step (3): Use FreeMAT to generate the list per your own magic formula

I personally use MATLAB to do everything. I love MATLAB, and I have been using it everyday for last 15 years. However I realize that not many people have access to the MATLAB. FreeMAT is a MATLAB alternative and it is a free software. So I am converting my MATLAB scripts to FreeMAT so that more people can use them.

Open FreeMAT:

Like MATLAB, FreeMAT allows you to run a script. Simply type the script name in the command window.(after à)

A script is a text file contains very understandable high-level programming language statements. If you know English, you should be able to understand it.

I wrote four scripts for this note.


I put all these four scripts in my other Blog-Financial Scripting With FreeMAT-
Copy all the 4 files, and put into the folder called “MagicList”. Then open the FreeMAT, type the command line,

àcd MagicList

This will move FreeMAT current directory to C:\FreeMat\MagicList

Then type,

àgen_myList

It will generate a file named “myList.html”.

Open the myList.html. It should contain the list of stocks that met my magic formula with hyperlink to a chart site.


Click the symbol, it will lead you to:

Now it is time to talk about my example “Magic Formula” so that you can change the script using your own magic formula.

The main script called “gen_myList.m” looks like this:


My “magic formula” is in the middle of the script:


As example for this article, my “magic formula” is simply that any stock is up more than 2%. Haha. No “MAGIC” about this magic formula.

Now it is your turn, change the middle part of the script to your formula, then you can generate a list of your own.

Everyday about 7:00pm, I run the Yahoo & Google Data Downloader, then I run my scripts to generate a list that I put onto my blog –Engineering an Edge in the Stock Market-

I will put more and more scripts into that blog, please check back if you are interested in scripting.

Please note that:
(1) The scripts are written for correctness, clarity and generality. The efficiency of the scripts is not a concern here. We want to produce code that is more likely to be correct, understandable, sharable and maintainable.

(2) Script running in FreeMAT is much slower than in MATLAB, please be patient.

blog comments powered by Disqus

My Favorite Books