It is an established notion among financial analysts that price
moves in patterns and these patterns can be used to forecast
future price. As the definition of these patterns are often
subjective, every analyst has a need to define and search
meaningful patterns from historical time series quickly and
efficiently. However, such discovery process can be extremely
laborious and technically challenging in the absence of a high
level pattern definition language. In this paper, we propose a
chart-pattern language (CPL for short) to facilitate
pattern discovery process. Our language enables financial analysts
to (1) define patterns with subjective criteria, through
introduction of fuzzy constraints; (2) incrementally compose
complex patterns from simpler patterns; and (3) automate trading
decision by specifying trading strategy using patterns. We
demonstrate through an array of examples how real life patterns
can be expressed in CPL. Consequently, CPL provides a high-level
platform upon which analysts can define and search patterns easily
and without any programming expertise.
CPL is a domain-specific language embedded within Haskell. We show
how various features of a functional language, such as pattern
matching, higher-order functions, facilitate pattern definitions.
Furthermore, Haskell's type system frees the programmers from
annotating the programs with types.