How to identify technical analysis chart patterns algorithmically?

  • I'm working on a small application that will provide some charts and graphs to be used for technical analysis. I'm new to TA but I'm wondering if there is a way to algorithmically identify the formation of certain patterns. In most of the TA literature I've read the authors explain how to identify these patterns visually. Is there a way to algorithmically determine these patterns so that I could, for example, examine the prices in code and identify a possible Head and Shoulders pattern?

  • As mentioned elsewhere on this site, Lo, Mamaysky, and Wang (2000) do exactly what you're talking about, namely algorithmic detection of head and shoulders patterns. Their definition:

    Head-and-shoulders (HS) and inverted head-and-shoulders (IHS) patterns are characterized by a sequence of five consecutive local extrema $E_1,...,E_5$ such that

    $$ HS \equiv \begin{cases} E_1 \text{ is a maximum} \\ E_3 > E_1, E_3 > E_5 \\ E_1\text{ and }E_5\text{ are within 1.5 percent of their average} \\ E_2\text{ and }E_4\text{ are within 1.5 percent of their average,} \end{cases} $$

    $$ IHS \equiv \begin{cases} E_1\text{ is a minimum} \\ E_3<E_1, E_3 < E_5 \\ E_1\text{ and }E_5\text{ are within 1.5 percent of their average} \\ E_2\text{ and }E_4\text{ are within 1.5 percent of their average.} \end{cases} $$

    Presumably this depends on the sampling frequency/resolution?

    Can someone explain what is meant with E1 is a Maximum?

    How is $E_1$ a maximum while $E_3 > E_1$. Can you explain?

    1 is a maximum means: Start with a left shoulder https://core.ac.uk/reader/213966840 So it is not a maximum peak?

    E1 is a local maximum. It's a mathematics term. It does not mean `max()`. E3(head) > E1(shoulder) is pretty simple -- head is above shoulder. Same thing for E5(shoulder). Shoulders E1 and E5 should be about level within 1.5%

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM