Page 1 of 1

Pattern Recognition/Computer Artificial Intelligence

Posted: Mon May 26, 2008 2:22 pm
by jklatt
Does anyone have any experience in this area?

There is a specific pattern that I really like to trade and it has worked rather well on a discretionary basis, but the pattern comes in similar yet different shapes and sizes and it's time consuming to flip through a lot of different charts and timeframes looking for this pattern. I also miss out on some (probably a lot more than I even realize) of the setups because I simply didn't look at that specific trading vehicle or that specific timeframe.

What I'm looking to do is something similar to teaching a computer to recognize the number "8". There are a lot of different ways the number 8 can be written (by humans and by computers -- all of which are valid "8"s) and the computer needs to be "taught" what is an "8" and what isn't in order to be able to scan through the data and find the pattern.

I'm not sure where to start when it comes to tackling this problem so I thought I'd write a post here to see if anyone might have some thoughts or be able to give me a nudge in the right direction.

Posted: Mon May 26, 2008 2:28 pm
by sluggo
If you are thinking about paying someone to help you with the job, a visit to this web page might provide a lead: ... rtners.htm

Posted: Mon May 26, 2008 5:07 pm
by 7432
or maybe these guys already have your pattern, or something close, in their system.

Posted: Mon Sep 14, 2009 9:35 am
by teppum
You need to break down the elements that make up that number 8. For example a Hammer candlestick pattern can be broken down into where along the days range the high and low fall. I would say for example that the open was within the top 5% of the range and the close was lower than the open but within say the top 25% of the days range.
You could then tell it to look for such candles after a downtrend. The downtrend could be signified in any way you like such as is the close more than x number of ATR's below n number of days ago close for example.
This is easy to programe in Visual Basic for example.

Posted: Tue Sep 15, 2009 4:45 am
by danZman
I've been going over this problem as well. My original idea just caught the pattern over one time frame with very basic pattern matching definitions. Sort of a zig zag indicator where the computer looks for peaks and valleys on the charts...makes for simple recognition:

p1 < p2, p1 - v1 > (p2 - p3) * 2 etc...

I think the next step I will take is to find a book on OCR. ... +character


Posted: Tue Sep 15, 2009 1:10 pm
by jklatt
I've actually been working on this the past few months.

I've been normalizing the data into coordinates on an imaginary rectangular "cork board" to mimic what I typically see on the screen when I look at a chart. From there, I looked at a lot of different charts and I took examples of the pattern I've traded/would have liked to have traded and plotted the data on the cork board. I then placed imaginary coordinate "pegs" in various spots on the cork board to get the general shape of the pattern and from there I've used some true/false statements to check and see if I have a valid pattern.

Then... I fed the pattern matching algorithm a lot of data. I used a range of 20 day to 240 day time frames across the all liquid portfolio and I got a lot of matches! The output took a while to create and it was a lot to digest in one sitting. So... since then I've backed off the range of time frames to a static 60 days and I've been making progress. The 60 day excursion ratio for the 60 day pattern across the all liquid portfolio is around 2.3. That's pretty good in my opinion and it's substantially better than anything I've found using moving averages and bbands and what not.

What I ultimately envision is checking to see if there is an edge at most of the time frames from 20 to 240 (or even higher) and blending these entries as they come in to generate positive expectancy trades with low correlated trade outputs. I think, in general, that's what one is really after.

Posted: Tue Sep 15, 2009 2:00 pm
by sluggo
klatt_attack wrote:... to generate positive expectancy trades with low correlated trade outputs. I think, in general, that's what one is really after.