Here's the code for a basic decision tree system in Matlab. I'm sharing it in response to a reader comment on the previous note. I re-wrote this system in R, which is what I was planning on sharing, and which I will be later. This code is not as clean as I would typically like to share and Matlab is not open source. 


When you unzip it, you'll see it's split up into two folders, production and release. The production version has a backtesting script wrapped around it so it's probably more interesting, but also slightly more complex. To run the production version use the function "sim2" and for the release version use the function "run". It will download the data from Yahoo, train and run the algorithm, and then give some output. 

The code is actually relatively short and clear so don't get intimidated at first. 

16 comments:

Anonymous said...

Hi Max,

Very cool dude!!!

How did you do in IB's Collegiate Olympiad?

I can't wait to see the FOSS version ;-)

Cordially,

-Digital Dude-

"For me the greatest satisfaction is always when the pictures come alive." -John Lasseter-

Max Dama said...

Dude,

At the end of the IB Olympiad I was disqualified for manual execution. The system generated the signals and then I would enter them into TWS. It was still a good proof of concept that a machine learning system can work, but I would rather they gave me a warning in the beginning.

Regards,
Max

chintan shah said...

FYI : http://en.wikipedia.org/wiki/War_on_Terrorism#Double_standards

http://en.wikipedia.org/wiki/Market_microstructure





this one is good source for ML algos in matlab

http://www.kyb.tuebingen.mpg.de/bs/people/spider/

Regards,
Chintan

Max Dama said...

Chintan,

It's too bad the spider package isn't updated anymore.


Max

Anonymous said...

Max,

Bummer that you were disqualified ;-( How did your system do? ;-)

Chintan,

The spider package looks almost as nice as similar packages in R and almost as terse ;-)

Cordially,

-Digital Dude-

"Fantasies and reality often overlap." -Walt Disney-

Max Dama said...

Digital Dude,

The system did well. It was profitable, market neutral, and signaled about 2-4 trades per day so profitability was statistically significant. It was a fun contest, I'm looking forward to this year's.

Regards,
Max

chintan said...

Hey (Digital Dude && Max),

Most of these open-source stuff weka/R/spider etc. are never updated after their creation.
If one wants to get serious on statistical stuff then S-Plus could be good bet compared to R.(S-Plus is costly!)

IB Olympiad is the ultimate filter for determining whether you are budding trader or not.If one cant make virtual money then how one can expect that he/she can make some real money!

in 2009, my system was made for trading fx instruments.But unfortunately it had suffered lot of loss due to choosing wrong time frame for signal generation but still i am happy that i figured in winners.

Looking forward to IB 2010 for to win some serious cash.

So Digital Dude, are you a student?

Take Care,
Chintan

chintan said...

Little Bit exaggerated article on robotics.

http://www.marshallbrain.com/robotic-nation.htm

Do you think its possible ?

Anonymous said...

Max,

Nice, it always feels good to have an edge ;-)

Chintan,

I'm a small spec, in the markets every day ;-)

R appears to be the de facto standard FOSS statistical environment and has a very active user and devo community.

Cordially,

-Digital Dude-

"The best way to predict the future is to invent it." -Alan Kay-

chintan shah said...
This post has been removed by the author.
chintan shah said...

Digital Dude,
Yes,R is one of the best FOSS compared to others.

Regards,
Chintan



"We know what we are, but we know not what we may become"
- William Shakespeare



"Enthusiasm is the yeast that makes your hopes shine to the stars. Enthusiasm is the sparkle in your eyes, the swing in your gait. The grip of your hand, the irresistible surge of will and energy to execute your ideas."
-Henry Ford

“Opportunity is missed by most people because it is dressed in overalls and looks like work.”
-Thomas Alva Edison

"Yodeling will not save us from Aplocalypse"
-Chintan Shah

chintan shah said...

Digital Dude,
Yes,R is one of the best FOSS compared to others.

Regards,
Chintan



"We know what we are, but we know not what we may become"
- William Shakespeare



"Enthusiasm is the yeast that makes your hopes shine to the stars. Enthusiasm is the sparkle in your eyes, the swing in your gait. The grip of your hand, the irresistible surge of will and energy to execute your ideas."
-Henry Ford

“Opportunity is missed by most people because it is dressed in overalls and looks like work.”
-Thomas Alva Edison

"Yodeling will not save us from Apocalypse"
-Chintan Shah

Anonymous said...

Thanks!!

sc

RafaCobo said...

Congratulations. Nice work. I will try to understand it.
Rafa

Rory said...

Octave is an open source replication of Matlab.
Very cool and multi platform.

Max Dama said...

Thanks