Archived

This topic is now archived and is closed to further replies.

bashung

financial patterns recognition (candlesticks)

Recommended Posts

I'm working on a financial analysis tool and I'd like to add an automatic pattern detection feature for some charts. The chart is composed of "candlesticks", they give a visual information about the highest/lowest price, opening and closing values for one day -> a candle is composed of 4 values. A dark candle means the closing price is below the opening price. There are typical patterns that indicate how the market behaves and I'd like to detect them using a neural-network or something adapted to this problem. Here's an example of such a pattern, most of them have 2 or 3 candles. This pattern indicates a "morning star" and everything that looks more or less like this (only consider the last 3 candles) should be considered as a morning star (it indicates a market reversal). More patterns and info here... Ok, my question is : what kind of neural network should I use ? I read about Kohonen, self-organizing NN and supervised NN using back-propagation. I'm unsure about which one is the best suited for my problem, I'm no expert in that field. Inputs would consist of at least 4*N values for N candles and maybe additional values like "height ratio between candle X and Y". I would train the network with some inputs that represent the pattern I'm looking for and some that aren't. The network should answer "true", "false", "unsure" or give a confidence probability. Thanks in advance for your help. [edited by - bashung on October 16, 2003 1:20:46 PM]

Share this post


Link to post
Share on other sites
Are you concerned with only looking for relationships between fixed numbers of candles (e.g., 3 candles) or would you like to be able to handle arbitrary length sequences? Obviously the latter is a more difficult classification problem, since shorter sequences may also be a part of a longer sequence. Utilising an ANN with a variable length input vector is also more difficult.

On the representation issue, each candle can be represented by a vector having as its attributes, the 4 pricing values plus the colour. I would suggest that you determine a classification of individual candles (similar to the one displayed on the linked page) so that you can map this vector to a single ''candle-type'' variable. Then, you want to classify sequences of these candle types and the positions of them relative to each other. You could do this by creating a vector of length equivalent to the sequence length. Each attribute of the vector is an integer representing the ''candle-type''. So, for a sequence of three candles, you''d have a 3 dimensional vector (Longer if you want to include relationship information between them... like candle 1 is higher than candle 2, or candle 1 overlaps the top of candle 2, etc). You can then plot this 3 dimensional vector in R3 and use a geometric classification technique to find sequences of common properties (clusters). Given a representation of these clusters (for example, a parametric description of cluster means and variances), you can classify any new sequence by the probability that it belongs to a given cluster.

An alternative to the above approach is to work with the raw data. The problem with this is that for a sequence of three candles, you''d end up with a 15 dimensional space to cluster; 5 dimensions per candle (4 values + colour) and 3 candles for the sequence.

I''d be interested to hear Predictor''s thoughts on this problem, given that he''s done a fair bit of this sort of thing.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
Thank you for your answer and also pointing me to a good representation for the inputs. I will extract many sets of 2 & 3 candles and analyze them separatly, I won''t analyze a complete sequence but rather extract interesting parts using other financial indicators, there are oscillators that indicate if the market is going down or up, this way I can estimate if a given pattern is potentially present in the sequence.

I searched on the web and found that some people used fuzzy logic to solve this problem, I will try this if my NN with BP attemps aren''t successful.

Share this post


Link to post
Share on other sites
I won't say that I put much stock (no pun intended) in technical analysis, but this problem is typical in the challenges is poses. There are two fundamental ways to solve a classification problem: 1. "by hand", programming a solution, or 2. via automatic learning, using regession, machine learning, etc. I'd guess that either way could be made to perform equally well (in terms of accuracy), but the real work will be in data preparation. Given the artificial nature of the pattern definitions, I would think that it would be easiest to program them, perhaps using fuzzy logic.




[edited by - Predictor on October 21, 2003 9:08:40 AM]

Share this post


Link to post
Share on other sites