Using Neural Networks to Identify Chart Patterns

Discussion in 'Strategy Building' started by Corey, Jan 26, 2008.

  1. Are you looking for something like this? http://www.youtube.com/watch?v=2XOMkkGafGc
     
    #11     Jan 31, 2008
  2. Corey

    Corey

    No, but cool nonetheless. Character recognition is something that NNs have been used for for a while.

    What I am looking for is how to train a neural network to identify chart patterns like support/resistance, pennants, flags, triangles, and whatnot. My biggest issue is that these patterns are fractal, meaning that they can occur in the 1 minute frame or the 5 year frame -- with ANY amount of bars comprising the pattern. So I can't figure out a comprehensive set of inputs that would help define them.

    Mind you, this isn't for a trading system -- this is for educational purposes only. Gotta feed the brain.

    Thanks.
     
    #12     Jan 31, 2008
  3. complete waste of time IMO. Considering how hard it is to describe these things and the years of training it takes for the worlds most advanced NN (between your ears) to see the patterns, it seems absurd to expect simplistic software NN to have even have a prayer.
     
    #13     Jan 31, 2008

  4. In that case, if I had to do this stuff, I would use Hull moving average to approximate price action. Then convert time series of moving average into input data as described in the youtube example:

    The rest is training the multilayer perceptron to recognize the patterns you want.


    P.S. do the same for all the time frames you wish to analyse (1 min, 1 daily, weekly, etc.)
     
    #14     Jan 31, 2008
  5. maxpi

    maxpi

    I've been wrestling with automation of trading systems from the viewpoint of expert systems for a long time. Making things simple enough for the computer to deal with is the main effort I have found myself involved in.... a wedge is a triangle is a flag really and they are very easy to define for the computer's consumption, A narrower bar inside a wider one is a wedge for example, it gets more complex the more bars that get involved before the breakout though. Fib retraces are easy if you identify the starting and ending point, if I was using those for anything I would start them at higher volume bars with extremes of volatility. I think those are more for psychological comfort to traders than for trading sometimes though... I have a large number of these simplified patterns that I need to run through a mixer somehow.. probably a neural net where I can input my own patterns like Neuroshell might be a place to start, if somebody knows of a better software please clue me in....
     
    #15     Jan 31, 2008
  6. The scale of the fractal shouldn't be relevant. Is it not the same as detecting a large N vs a tiny n? The nn would converge to the n regardless of size if properly designed, since it is closest to ideal pattern.

    If you have a finite set of patterns, I would think it would be similar to having a finite set of letters to train.

    The scaling of the pattern is equivalent to scaling of the letter, given a finite boundary.
     
    #16     Jan 31, 2008
  7. Corey

    Corey

    Agreed to a certain extent. With character recognition, it is possible to take the bounding box around the character and scale it to the correct number of inputs (pixels) to feed the NN. So a large N could be scaled quite easily, without losing shape or form, to a 100x100 input to a NN. Hell, even a very elongated N could be squished to create a more well formed 100x100 N.

    I agree that the same concept applies to patterns. My issue, however, is choosing what the inputs should be. Let's take a flag for example. What inputs should I use? Should I just use the slope of the resistance and support lines? Can I just feed it any number of closing prices on bars? Where do I draw the line?

    I suppose I could define the number of 'closing' prices I wanted as inputs (as defined to a relative distance from surrounding prices, or something like that) -- and for flags that contained more bars, simply collapse the number of bars until it fits. So given a flag that took 100 bars, I could increase the bar time until that flag was made up of only 15 bars. Would this work?

    The wheels are turning... Thanks!
     
    #17     Jan 31, 2008
  8. mokwit

    mokwit

    You may be right as afae as NN goes and also in trying to program geometric perfection as per all the charting books, but most patterns have a few simple elements that can be coded for. The mistake is to try and code geometric perfection and not accept that you will be looking at quite a few patterns that are correct according to your rules but not according to what you are looking for.


    Also contrary to the philosophy of Edwards & Magee and a lesser extent Schabaker looking for overly geometric patterns and not needing to care about how or why they form is barking in the wrong forest. You have to know how and why those patterns form where they do and in the way the do.
     
    #18     Jan 31, 2008
  9. Instead of starting training with bars or candlesticks, why not make it simple and start out with line patterns.

    For instance a flag made up of a line, vs a broadening triangle both have unique characteristics that can be identified, although they are relatively simple.

    Take bullkowski's encylopedia of patterns and train each pattern in your simple network (I think there are less than 26). Adding more nn inputs would increase pattern recognition, but slow down your system. Need to trade off for optimal detection.
     
    #19     Feb 1, 2008