Download Full Report: Here
Signal processing is the process of using a computer for numerical calculations. Multiple algorithms have been created that improve the process of identifying signals. Though computer capability have increased, humans are necessary to manipulate algorithms so they can be efficiently implemented. We implement these techniques to find patterns in the future movements of financial securities. Below we will describe the use of TD in pattern recognition.
Trend decomposition (TD) is a nonlinear signal- transformation method developed by Huang et al. (1998, 1999). It is used to decompose a nonlinear and non-stationary time series into a sum of intrinsic mode function (IMF) components with individual intrinsic time scale properties.
IMF must satisfy the following two conditions:
1.) The number of extreme values and zero-crossings either are equal or differ at the most by one.
2.) The mean value of the envelope constructed by the local maxima and minima is zero at any point .
Figure 2 gives us the trend after S&P price has finished decomposing. The six functions in Figure 1 represent IMFs at different frequencies. When you subtract them from the original stock price, you arrive at Figure 2, the trend.
Signal Processing Applied to Trading
We adapt techniques from TD decomposition to create our signal processing strategy. First, we apply pattern recognition to identify support and resistance using Trend Decomposition.
First we identify local maximum and minimum of original time series following same process as TD. Figure 3 shows local maximum and minimum points for the S&P Index.
We link all local maxima and local minima using interpolation to form an envelope line of the original time series. Interpolation is a method of constructing new data points given a set of known variables. Figure 4 below shows interpolation applied to S&P
To smoothen our envelope line, we apply interpolation on our existing envelope. Figure 5 shows our new lines. This creates less variability between the two curves.
We apply first order polynomial regression to our new envelope. The regression creates a straight line representative of a trend. It uses historical data to set a threshold for its parameters. The threshold is based on recognizing patterns in sum of squared errors over a time period. We finally arrive at our support and resistance lines, as seen in Figure 6.
We have our support and resistance lines, now we use this information to predict the future movement of the S&P Index. We apply three different strategies on this signal: breakout, slope, and mean-reversion. Below we describe the process for our breakout strategy.
Determine when to enter and exit positions using breakout from support and resistance lines. If stock price goes more than x percent outside support or resistance line, enter a position. Close using a stop loss. We recalculate the support and resistance lines every five periods, giving us predictions from time(t) to t5 at each calculation.
Parameter 1: Break out percentage = Constant1 * Volatility[past 60 days]
Parameter 2: Stop-loss percentage = Constant2 * Volatility[past 60 days]
To find the constant we apply grid search to all combinations of stop loss and position enter thresholds. Determine the best combination of the two parameters. A separate constant is used for each.
Volatility is incorporated into the entry and exit positions because high volatility cycles that would result in us entering a position could easily trigger stop losses. We define volatility as the standard deviation of returns over a given period.
To test our strategy, we use data on S&P 500 Index exchange traded fund SPY from 2006-2017. January 1, 2006-July 31, 2011 are in sample data (Figure 7), and August 1, 2011-February 1, 2017 are out of sample.
The period used for in sample testing shows strong backtested results from 2006-2011 on the S&P 500 Index ETF. This strategy executed 13 trades during the period, but had worse performance from 2011-2017. We will next apply trend decomposition to higher frequency data. The signal will track the trend of a security and enter a position if over a threshold. Stay tuned for future research.
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.