Premium Market Analysis, Trader Education, Software, and Trading Strategies. Thirty Years Of Skin In The Game

Price Action Strategies, Quantitative trading

Increasing the length of Price Patterns in Short-Term Trading

The optimum length of short-term price action patterns used to generate entry and exit signals depends on market conditions and cannot be determined in advance. It often pays to use a mix of patterns that respond to different market conditions. In short-term trading there are no fixed rules but performance is path dependent.

The new version of Price Action Lab that was just released can discover price patterns in historical data that fulfill user-defined performance criteria and risk/reward parameters and also have a length up to 9 bars as compared to previous versions where the maximum length was 6 bars. Note that the pattern length refers to the number of bars from the first to the last bar in the pattern but not all bars play a role in the pattern formation except the first and the last. For example, the simple trading rule c[0] > c[8] is a valid 9-bar pattern that triggers a signal when the close of the last bar is higher than the close of 8 bars ago.

Analysis

We will use v7.0 of Price Action Lab to discover 5-bar and 9-bar price patterns separately in SPY unadjusted data since inception to 12/31/2008. Then, the two separate groups will be tested on an out-of-sample from 01/02/2009 to 11/28/2014 and their performance will be compared. Although the out-of-sample period represents a long uptrend (but in hindsight only), we are interested in the performance of the two groups during 2011 where the performance of unadjusted SPY was nearly flat after a substantial correction. The profit target and stop-loss for the search of price action patterns were both set to 2.5%. The parameters used for the search are shown on the workspaces below:

5-bar patterns

Below is the search workspace:

SPY_C5_WKS

Each pattern must have at least 31 trades, less than 8 maximum consecutive losers, profit factor greater than 1.5 and win rate greater than 66%. The results of the search are shown below:

SPY_C5

PAL identified 8 patterns that fulfilled the criteria specified on the workspace, 8 long and 1 short. Note that in trending markets there will always be more long patterns than short but every system can be turned into long/short symmetric. In addition, several of the long patterns are correlated.

Next, code for Amibroker was generated and the system was tested on the out-of-sample (no need to show in-sample results as they will always be good by design). Initial capital was set at $100,000, commission was set at $0.01/share and equity was fully invested on each trade resulting in a risk percent of 2.5%, equal to the stop-loss:

SPY2p5_C5_2009to2014_AMI

The blue line is the buy and hold for the period considered. Note that we should not expect such a system to perform better than buy and hold because it is just an example for 5-bar patterns. We are only interested in a comparison with 9-bar patterns. Below is monthly return data:

SPY_C5_2009to2014_MoRet

It may be seen that although overall performance is positive and results in a CAR equal to 5.15% in the tested period, performance during 2011 is highly negative at -16.3% and for 2013 it is low at 3%.

9-bar patterns

Below is the search workspace:

SPY_C9_WKS

Also in this case each pattern must have at least 31 trades, less than 8 maximum consecutive losers, profit factor greater than 1.5 and win rate greater than 66%. The results of the search are shown below:

SPY_C9

PAL identified 14 patterns that fulfilled the criteria specified on the workspace, 13 long and 1 short. Again, note that in trending markets there will always be many more long patterns than short but every system can be turned into long/short symmetric. In addition, several of the long patterns are correlated.

Next, code for Amibroker was generated and the system was tested in the out-of-sample (no need to show in-sample results as they will always be spectacular by design). Initial capital was set at $100,000, commission was set at $0.01/share and equity was fully invested on each trade resulting in a risk percent of 2.5%, equal to the stop-loss:

SPY2p5_C9_2009to2014_AMI

The blue line is the buy and hold for the period considered. Note that we should not expect such a system to perform better than buy and hold because it is just an example for 9-bar patterns. We are only interested in a comparison with 5-bar patterns. Below is monthly return data:

SPY_C9_2009to2014_MoRet

It may be seen that in this case performance for 2011 is nearly flat and for 2013 it is above 20%.  The table below summarizes the analysis results for 5-bar and 9-bar patterns in the out-of-sample period from 01/02/2009 to 11/28/2014:

 Parameter 5-bar patterns  9-bar patterns 
 CAR 5.15%  7.79% 
 Win rate 56%  57% 
 Trades 117  114 
 Profit factor 1.28  1.45 
 Payoff ratio 1.02  1.20 
 Sharpe ratio 0.65  0.90 
 Max. DD -22%  -14% 
2011 perf.  -16.3%  -0.3% 
2013 perf  3%  20.4% 

Conclusion: The system consisting of 9-bar patterns performed better in the out-of sample than the system with the 5-bar patterns. Note that both generated about the same number of trades.

Notes

1. This was just one example where longer patterns performed better. In general, performance will depend on market conditions. The choppier the price action is, the better the performance of shorter length patterns. This is one reason PAL v7.0 offers the option of selecting the pattern length during the search. One could develop several systems based on different lengths and switch between then according to volatility conditions.

2. It is always better to have a mix of patterns with various bar lengths and use signals from increasing bar length as confirmation of those with shorter bar length. Such systems are a bit more complicated to develop but may offer confirmation of price action.

3. We should not expect a system that was developed using data that ended 5 years ago to work well in the future. Out-of-sample testing is used for analysis purposes only, not for developing systems. There is a lot of confusion in this area and several different approaches. After the out-of-sample analysis shows that a concept is sound, it is better to use all of the available data to develop a system. There is a caveat here: the development process must be of deterministic nature. The above do not apply to systems developed by algorithms that use randomization, like genetic algorithms, and out-of-sample testing is necessary in those cases and this implies deprivation of known market conditions during development, higher degree of curve-fitting because of less data and higher probability of failure in the future. It is important to subject a system to as a wide range of market conditions as possible during the design phase. Out-of-sample testing deprives the design phase from market conditions and thus increases failure rates of systems that may pass it by chance alone.

You can subscribe here to notifications of new posts by email.

Disclosure: no relevant positions.
Charting program: Amibroker
Disclaimer