# Geometric Patterns Predict Stock Returns

August 15, 2017

View full report here

Computational Algorithms

The geometric strategy identifies trend reversals in stock prices by recognizing significant price points than make sure a specific shape. These patterns trigger signals on both the long and short side, outperforming a randomly selected portfolio during our testing period from 2014-2016.

Preprocessing

We input historical closing prices for the top 25 market capitalization companies in the Nasdaq exchange from 2006-2017. Each data point is converter to a return, creating a stationary variable proper for prediction. In this research we focus only on the framework for a daily trading strategy, using end of day closing prices.

Stock volatility external market forces makes future prices harder to predict. We apply a smoothing technique to more easily track the trend of our data. Empirical mode decomposition, kernel regression and exponential smoothing are methods we test, finding kernel regression to work best. Figure 1. shows original Apple closing price compared to a smoothed time series.

The new price series takes a version of mean and calculates long-term averages with lower volatility. We tune the bandwidth parameter to determine the width of the kernel used, in our case, how many days to use for smoothing. Figure 2. displays the effect different parameters have on an original time series.

The larger the parameter, the smoother the data, but you are avoiding the risk of missing information. One option is to set a fixed bandwidth, such at 0.2. A more optimal technique is to use cross validation, which iterates between multiple options for bandwidth and calculate the mean squared error for different parameters. This gives a more optimal solution, but costs us processing time to calculate on a daily basis. To save processing time, we test in-sample and out-of-sample results and identify how robust the result is. We find that 2.0/2,800 is the optimal solution, because 2.0 was our initial bandwidth and 2,800 data points were in our sample size. Finally we have our fitted curve.

Extrema Signals

We identify maximum points in the function by looking at three consecutive points to see if they meet the criteria: E1<E2>E3. If the smoothed stock data identifies a local maximum, or the inverse (local minimum) then we move to the original data and find the position of the same extrema point. Figure 3. shows a time series with the smoothed extremas and their points on raw data.

Developing Geometric Patterns

We develop four unique patterns, each of which uses the extrema points from Figure 3. as their inputs.

The five points that create the AlgoX pattern are illustrated in Figure 4. On the fifth point, we receive a buy signal.

Parameter Optimization

We now have the signals for entering positions and optimize them for holding period and risk controls using grid search. Grid search is a model used to search through combination of variables and outcomes to determine the optimal set. For each pattern, we apply this technique for two parameters in two in-sample tests. Its benefit is that we can analyze all possible combinations in a faster time, as shown in Figure 5.

First we look at 2012-2014 for all patterns and their unique parameters, analyzing their win rate, profit, and drawdown during this period. We then select the top four sets of parameters for each pattern to test the period of the financial crisis to see performance during a bull-bear-bull market. From these four sets of parameters for each strategy, we finally select one best performer to analyze the results out of sample.

Strategy

Our portfolio is allocated across the four geometric patterns.

Holding period and risk controls vary by strategy, as each is optimized individually. We target a 65-35 long-short allocation. AlgoR is short-only, while the others are long-only. This provides a hedge portfolio, expected to create more stable returns.

Results

We break our data in three time periods, 2006-2011, 2012-2014, and 2015-2016 (out-of-sample). During in-sample tests, we optimized parameters based on the prediction accuracy and returns. Finally we selected one set for trading 2015-2016, with a portfolio weighted 35-25-20-20 across four signals. Figure 7 shows the cumulative profit and loss produced in our portfolio compared with the benchmark S&P 500.

Note: Past performance not indicative of future returns. Returns are backtested and not net of taxes.

The results are more profitable and stable than the S&P 500 buy and hold strategy. We observe accuracy, drawdown, and cumulative returns to determine that the geometric shapes strategy outperforms in the period from January 1st, 2015 till January 1st, 2017.

Important Disclaimer and Disclosure Information

Algo Depth makes no representations of any kind regarding this report. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the absence of errors, whether or not known or discoverable. In no event shall the author(s), Algo Depth or any of its officers, employees, or representatives, be liable to you on any legal theory (including, without limitation, negligence) or otherwise for any claims, losses, costs or damages of any kind, including direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages, arising out of the use of the report, including the information contained herein.

This report is prepared for informational and educational purposes only, and is not an offer to sell or the solicitation of an offer to buy any securities. The recipient is reminded that an investment in any security is subject to many risks, including the complete loss of capital, and other risks that this report does not contain. As always, past performance is no indication of future results. This report does not constitute any form of invitation or inducement by Algo Depth to engage in investment activity.

Algo Depth has not independently verified the information provided by the author(s) and provides no assurance to its accuracy, reliability, suitability, or completeness. Algo Depth may have opinions that materially differ from those discussed, and may have significant financial interest in the positions mentioned in the report.

This report may contain certain projections and statements regarding anticipated future performance of securities. These statements are subject to significant uncertainties that are not in our control and are subject to change.

Algo Depth makes no representations, express or implied, regarding the accuracy or completeness of this information, and the recipient accepts all risks in relying on this report for any purpose whatsoever. This report shall remain the property of Algo Depth and Algo Depth reserves the right to require the return of this report at any time.

###### Featured Posts

I'm busy working on my blog posts. Watch this space!

January 27, 2018

Home

Fellowship

Events

### Quantitative Research

Investment Managers

Data Providers

Research