Letters To S&C by Technical Analysis, Inc.
DETECTING PATTERNS ALGORITHMICALLY
I work on program analysis, machine learning, and have a doctorate in software engineering. I like to do stock analysis as a hobby and am interested in chart pattern detection. For example, I wrote some code to detect the flag pattern. I came across Siligardos’ articles in S&C about detecting rounding bottoms, detecting rounding bottoms early, and detecting trendlines [“Identifying The Cup (With Or Without The Handle),” February 2006; “Identifying Cup Formations Early,” April 2011].
I loved his work in the articles. I have implemented his rounding bottom detection method, but I have the following questions:
1. The algorithm to detect rounding bottoms early does not indicate how long the stock will stay on the bottom. If I want to estimate how long the stay would be, what would his opinion be of this? Or is this not worth doing?
2. The algorithm to detect trendlines needs a parameter for the swing indicator. To use the algorithm to scan through thousands of stocks, I will need to use a value for this parameter for each stock. This is a parameter-optimization problem. What is his opinion about this? Would he suggest using a default value for all the stocks, or optimize this parameter for different stocks? If the latter, what is his opinion of the optimization goal? For example, to minimize the loss function used to describe how well the swing indicator covers local minimums and maximums.