21
Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky, and Jiang Wang Presented by Xiaodai Guo

Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Embed Size (px)

Citation preview

Page 1: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Foundations of Technical Analysis: Computational

Algorithms, Statistical Inference, and Empirical Implementation

Written by Andrew W.Lo,

Harry Mamaysky,

and Jiang Wang

Presented by Xiaodai Guo

Page 2: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Main Idea of the Paper

Combine chart patterns of technical analysis with quantitative trading skills by achieving three sub-goals:

I. Smooth the data .II. Define technical patterns mathematically, identify them

and use them to do algorithm trading.III. Ways to test the statistical significance of the results

(skipped).

Page 3: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Example: What is a technical pattern:

Head and Shoulder Top: a signal for sell

Page 4: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the dataWhy smoothing the data?

Raw stock price data in reality is very noisy, and to observe the patterns behind the data, we must filter out the noise:

0 10 20 30 40 50 60 70 809

9.5

10

10.5

11

11.5

12

12.5

time(day)

stoc

k pr

ice

Page 5: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the dataHow to smooth the data?

A traditional way used by technical analysts to smooth the data:

SMA(simple moving average):For any day(Day M):

Shortcomings:1. Every data point is assigned the same weight.2. At every point of time M, only the information at

and before M is used for smoothing.

Page 6: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the dataHow to smooth the data?

A new way proposed by this paper:

A smoothing estimator using Kernel Regression:

is a weight which is calculated using the Gaussian kernel.

Page 7: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the dataHow to smooth the data?

Intuition: For any time point x, its smoothed estimator should be the weighted average of all the time points t in the time window (t ranges 1 to T).(x) has a value which is proportional to , so the farther t is from x, the less weight point t will have when used for estimating x.

Page 8: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the dataHow to smooth the data? (skip)

Important formulas:

Important concepts:Kernel: a weight function which is constructed from a probability density function.Gaussian Kernel: a weight function which is constructed from the density function of normal distribution.

Page 9: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the data

Example: After smoothing VS before smoothing

0 20 40 60 809

9.5

10

10.5

11

11.5

12

12.5

time(day)

price

before smoothing

after smoothing

Page 10: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part I: Smoothing the dataAnother Example: After smoothing VS before smoothing

0 10 20 30 406.8

7

7.2

7.4

7.6

7.8

8

8.2

8.4

8.6

8.8

time(day)

price

before smoothing

after smoothing

Page 11: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part II: Identifying patterns

A. What is “local extrema”

Local maximum(minimum):

A day whose stock price is higher(lower) than the stock price of the days before and after it.

Page 12: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part II: Identifying patterns

B. Define the technical patterns mathematically

Page 13: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part II: Identifying patterns

B. Define the technical patterns mathematically

Head-and-shouldersReverse head-and-shoulders

Broadening topsBroadening bottoms

Triangle topsTriangle bottoms

Rectangle topsRectangle bottoms

Double topsDouble bottoms

Page 14: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part II: Identifying patterns

C. Test out whether patterns exist in smoothed data

How do we look for patterns:For every time window of 38 days, do the smoothing, and then test for patterns using the first 35 days’ smoothed data.

Constraint: The last local extrema of the pattern must appear on the 35th day.

Page 15: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part II: Identifying patterns

D. Calculate the results

How do we trade:According to the author ,for every time window of 38 days, if a pattern is observed, we long/short the stock at the closing price of the 38th day, and close our position at the closing price of the 39th day.

A modification:For every time window of 38 days, if a pattern is observed, we long/short the stock at the closing price of the 39th day, and close our position at the closing price of the 40th day.

Page 16: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part III: Results

A. Calculate the results

Implement a back testing using Ford’s daily stock price from 1993/9/24 to 2013/9/24.

Page 17: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part III: Results

B. The results of back-testing

Number of transactions occurred:130The probability of one transaction to make money:49.2%Mean return of transactions:0.207%Standard deviation of mean return of transactions:0.263%P-value of the mean return under t-test:0.2927

Page 18: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part III: Results

C. An improved trading strategy

An improved trading strategy:After detecting a pattern, instead of holding the stock for one day, we will hold it for five days.

The reason for this improvement:Practitioners want to take full advantage of the technical patterns discovered.

Page 19: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part III: Results

D. Back-testing results of the improved trading strategy

Number of transactions occurred:130The probability of one transaction to make money:53.8%Mean return of transactions:0.816%Standard deviation of mean return of transactions:0.488%P-value of the mean return t-test:0.0986

Page 20: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part IV: Pros and cons

What we can learn from this paper:

• How to smooth the data with kernel regression.

• How to define technical patterns in a numerical way.

• How to use patterns to trade quantitatively

Page 21: Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation Written by Andrew W.Lo, Harry Mamaysky,

Part IV: Pros and cons

Criticism:

• When optimizing the bandwidth h for kernel regression, the author uses the “Cross-Validation” method, which seems to be inappropriate for this problem. Also, the author multiplies this optimized h value by 0.3, which makes this optimization process even less rigorous.

• Many of the parameters are ad-hoc and come from “empirical experience”, which is not well-explained in this paper.

Examples: length of the time window; percentage numbers used in definitions of technical patterns.