Newsletter
Article Library
Videos
What's New
About Us
Site Map
Search

 

 

The Breakout Bulletin

The following article was originally published in the September 2012 issue of The Breakout Bulletin.
 

A High Accuracy Long-Term ETF Strategy

Sometimes the line between "trader" and "investor" is a thin one. As the holding time for trades increases, trading starts to feel a lot like investing. From the standpoint of a short-term trader, holding a trade for months at a time probably sounds like an investing strategy. On the other hand, a long-term buy-and-hold investor probably feels like he's trading the market if he exits a position within the same calendar year. This article attempts to bridge that divide by applying techniques normally associated with shorter-term trading to the development of a long-term ETF strategy.

 

Suppose you're looking for a place to invest some of your trading profits as a way to diversify your assets. You want to buy and hold for the next year or two, but you want to avoid buying if the market is going to drop again, as it did in 2000 - 2003 and again in 2008. Basically, you want to be long the stock market every year except the down years. Your goal is less about gains than about avoiding losses.

 

Discovering Long-Term Strategy Logic

To develop a viable long-term trading strategy, we'll start with a fairly simple set of requirements. We want to find strategy logic that holds trades for one year, minimizes the number of losing trades, and demonstrates statistically significant results, particularly in out-of-sample testing. To achieve the goal of skipping down years in the market, the accuracy of the strategy has to be high, probably on the order of 80% or more.

 

To find the strategy logic that achieves these goals, a strategy discovery tool called Adaptrade Builder will be used. Builder uses a genetic programming algorithm to find strategy logic and generate the corresponding strategy code based on the user's performance criteria. The program uses out-of-sample testing to validate the strategies it comes up with. The key settings used in the program were as follows:

 

Markets (ETF indexes, by symbol)

SPY (S&P 500 index)

QQQ (NASDAQ 100 index)

IWM (Russell 2000 index)

DIA (Dow Jones index)

XLF (financial sector index)

XLE (energy sector index)

 

A variety of stock index ETF's was chosen in order to make the final strategy more robust. For all markets, weekly bars were used. The market data was obtained from the TradeStation platform (TS 9.0), and all available data was used for each symbol. The entire date range over all markets was Feb 5, 1993 to Sep 26, 2012. The initial two-thirds of the date range was used for building the strategies (in-sample), and the last third was used for out-of-sample testing. Because the SPY is older than the other ETF's, the available history for the other symbols started in 1999. Consequently, the first six years of data consisted of only the SPY.

 

Build Metrics

Maximize Net Profit with weight 1.000

Maximize Correlation Coefficient with weight 1.000

Maximize Statistical Significance with weight 1.000

Target Average Bars in Wins to 52 with weight 1.000

Minimize Maximum MAE (maximum adverse excursion) with weight 1.000

The key metric here is the target value of 52 for the average number of bars in wins. This is intended to guide the build process towards strategies that exit after one year; i.e., after 52 weeks. Also note that the maximum adverse excursion was included as a metric. This was done because with such a long holding time, it's possible that the intra-trade drawdown could be quite large. Minimizing the worst-case MAE is one way to avoid large intra-trade drawdowns.

 

Entry and Exit Orders

Enter at market

Exit after N bars in market (e.g., N = 52 for a one-year hold period)

 

Strategy Logic Options and Settings

Long-only strategies

Tree depth of 2 to keep the strategy logic simple

Trading costs of $50 per 100 shares

 

The Builder file containing all the settings used for this project, as well as the resulting EasyLanguage strategy code for TradeStation and MultiCharts, is available here for download (right-click the link, select "Save target as..." and change the file extension to .gpstrat).* This file can be opened within the Builder program. A free trial of Builder is available at www.adaptrade.com.

 

*The price data for the ETF's is licensed through TradeStation and the associated exchanges and is therefore not included in the download file.

 

Strategy Build Results

The desired one-year holding period was achieved via the target for the average bars in winning trades, as explained above. Because all trades were required to exit based on the "exit after N bars" order type, the build process was guided towards a value of N close to 52. However, the metric for the number of bars is a target, not a strict requirement, and there's no guarantee that the target will be met exactly. The final strategy had a value of N equal to 53, which means the trades exit after 53 weeks.

 

The strategy logic found by the program to best achieve the chosen build goals is as follows:

KeltnerChannel(H, 21, 2.78) crosses above High

This means that if the 21-bar Keltner channel computed from the highs, using a band width of 2.78 multiples of the average true range, crosses above the high price on the closed weekly bar, a long trade is entered on Monday's open. Each trade is held for 53 weeks then exited at the next week's open.

The portfolio equity curve showing how this strategy performed on the six ETF's is shown below in Fig. 1. Each trade was sized so that the value of the trade was 1/6th of the starting account size of $100,000, and the number of shares was rounded down to the nearest 100 shares.

 

Figure 1. Portfolio equity curve (thick line) for long-term ETF strategy. The equity curves for each ETF in the portfolio are shown by the curves below the portfolio line.

 

Not only is the combined (portfolio) equity curve straight and smooth, but, as can be seen from the curves for each individual market, each market contributes to the in-sample performance, and all markets except the XLF are profitable out-of-sample.

 

Here are some summary performance results for the strategy applied to the six markets together as a portfolio, as tabulated over both the in-sample and out-of-sample periods:

 

Closed Trade Net Profit: $61,464.00
Profit Factor: 37.651
Number of Closed Trades: 31
Percent Profitable: 90.32%
Average Winning Trade: $2,255.04
Average Length of Wins: 1 years 12 days
Max Number Consecutive Wins: 18
Average Losing Trade: ($559.00)

Average Length of Losses: 1 years 12 days

Worst Case Drawdown: $13,010.00 (10/7/2011)

 

Full performance results are available in the Builder project file (above).

 

Also of interest are the specific trades taken during the back-test. These demonstrate how the strategy mostly skipped the down years in the market, as intended.

 

Table. Back-tested trade results for long-term ETF strategy. Gray-shaded rows: in-sample trades; green/red shaded rows: out-of-sample trades.

Trade Symbol Entry Date Entry Price Exit Date Exit Price Direction Quantity Profit/Loss Costs Net Profit/Loss
1 SPY 7/16/1993 16:00 44.92 7/29/1994 16:00 45.34 Long 300 $126.00 $150.00 ($24.00)
2 SPY 8/18/1995 16:00 55.79 8/30/1996 16:00 66.7 Long 200 $2,182.00 $100.00 $2,082.00
3 SPY 12/20/1996 16:00 73.5 1/2/1998 16:00 94.59 Long 200 $4,218.00 $100.00 $4,118.00
4 SPY 4/24/1998 16:00 112 5/7/1999 16:00 133.44 Long 100 $2,144.00 $50.00 $2,094.00
5 DIA 7/3/1998 16:00 89.71 7/16/1999 16:00 112.11 Long 100 $2,240.00 $50.00 $2,190.00
6 XLE 6/18/1999 16:00 28.75 6/30/2000 16:00 31.69 Long 500 $1,470.00 $250.00 $1,220.00
7 XLF 6/18/1999 16:00 24.63 6/30/2000 16:00 24.19 Long 600 ($264.00) $300.00 ($564.00)
8 QQQ 8/20/1999 16:00 57.63 9/1/2000 16:00 98.25 Long 200 $8,124.00 $100.00 $8,024.00
9 IWM 12/8/2000 16:00 45.73 12/21/2001 16:00 46.83 Long 300 $330.00 $150.00 $180.00
10 IWM 5/30/2003 16:00 41.63 6/11/2004 16:00 56.94 Long 300 $4,593.00 $150.00 $4,443.00
11 QQQ 6/20/2003 16:00 30.17 7/2/2004 16:00 37.49 Long 500 $3,660.00 $250.00 $3,410.00
12 SPY 6/20/2003 16:00 99.96 7/2/2004 16:00 114.52 Long 100 $1,456.00 $50.00 $1,406.00
13 XLF 6/20/2003 16:00 25.45 7/2/2004 16:00 28.89 Long 600 $2,064.00 $300.00 $1,764.00
14 XLE 6/27/2003 16:00 24.4 7/9/2004 16:00 31.85 Long 600 $4,470.00 $300.00 $4,170.00
15 DIA 2/13/2004 16:00 105.58 2/25/2005 16:00 107.07 Long 100 $149.00 $50.00 $99.00
16 XLE 10/29/2004 16:00 35.55 11/11/2005 16:00 49.2 Long 400 $5,460.00 $200.00 $5,260.00
17 IWM 12/17/2004 16:00 63.42 12/30/2005 16:00 68.35 Long 200 $986.00 $100.00 $886.00
18 QQQ 12/31/2004 16:00 39.98 1/13/2006 16:00 42.66 Long 400 $1,072.00 $200.00 $872.00
19 XLF 12/9/2005 16:00 32 12/22/2006 16:00 36.71 Long 500 $2,355.00 $250.00 $2,105.00
20 DIA 12/8/2006 16:00 121.78 12/21/2007 16:00 132.73 Long 100 $1,095.00 $50.00 $1,045.00
21 SPY 12/8/2006 16:00 140.25 12/21/2007 16:00 146.61 Long 100 $636.00 $50.00 $586.00
22 QQQ 12/15/2006 16:00 43.83 12/28/2007 16:00 52.01 Long 300 $2,454.00 $150.00 $2,304.00
23 XLE 7/6/2007 16:00 69.11 7/18/2008 16:00 82 Long 200 $2,578.00 $100.00 $2,478.00
24 DIA 10/2/2009 16:00 96.75 10/15/2010 16:00 110.03 Long 100 $1,328.00 $50.00 $1,278.00
25 QQQ 10/9/2009 16:00 41.09 10/22/2010 16:00 51.52 Long 400 $4,172.00 $200.00 $3,972.00
26 XLF 4/30/2010 16:00 16.77 5/13/2011 16:00 16.06 Long 900 ($639.00) $450.00 ($1,089.00)
27 IWM 5/14/2010 16:00 68.55 5/27/2011 16:00 81.42 Long 200 $2,574.00 $100.00 $2,474.00
28 QQQ 11/26/2010 16:00 52.25 12/9/2011 16:00 57.49 Long 300 $1,572.00 $150.00 $1,422.00
29 XLE 11/26/2010 16:00 63.15 12/9/2011 16:00 71.7 Long 200 $1,710.00 $100.00 $1,610.00
30 DIA 3/11/2011 16:00 121.77 3/23/2012 16:00 131.91 Long 100 $1,014.00 $50.00 $964.00
31 SPY 3/11/2011 16:00 132.86 3/23/2012 16:00 140.21 Long 100 $735.00 $50.00 $685.00
32 QQQ 4/27/2012 16:00 65.08 open NA Long 200 $554.00 NA $554.00
33 XLF 4/13/2012 16:00 15.24 open NA Long 1000 ($190.00) NA ($190.00)

 

For example, in the in-sample period (gray shaded rows), there were no trades from the end of 2001 until May 2003, and the only trade in 2001 was a profitable trade in the Russell 2000 ETF (IWM). In the out-of-sample (OOS) period (green-shaded rows), the only trade taken in 2008 was a profitable trade in the energy sector ETF (XLE), which exited prior to the market drop in October of that year. In fact, the only closed trade loss in the OOS period was a financial sector ETF (XLF) trade in 2011.

 

Conclusions

While most people probably think of trading and investing as separate disciplines, in reality, it's probably more like a spectrum of disciplines from high frequency trading to long-term buy-and-hold investing. In this article, I applied techniques more often associated with developing short-term trading strategies to the development of a long-term long-only ETF strategy.

 

The strategy I came up with (with the help of the Builder software) uses a simple entry condition based on the Keltner channel to enter long on weekly bars. The trade is exited after 53 weeks. By waiting for the Keltner channel to cross above the high before entering the market, most major down periods are avoided. The same logic seems to work equally well on different stock indexes, including those for large-cap stocks, small-cap stocks, technology stocks, financials, and energy stocks.

 

One potential criticism is that the trade history only includes 31 closed trades. However, the small number of trades is at least somewhat mitigated by several factors. First, the results seem to generalize well in the out-of-sample period. Secondly, the logic is very simple and therefore less likely to be over-fit. Finally, the same logic seems to work well on a variety of stock index ETF's.

 

Rather than taking the strategy developed here as the definitive 12-month-holding-period ETF strategy, I would suggest using the approach outlined in this article as a starting point for developing your own long-term ETF or stock trading strategy. Preliminary testing suggests that there are other entry conditions in addition to the Keltner channel that could be used as the basis for similar strategies. The key is to use a disciplined approach to strategy design with well-defined goals in mind, and, as always, test everything thoroughly, preferably via real-time tracking, before committing real money.

 

Mike Bryant

Breakout Futures

 

 

HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN INHERENT LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT ACTUALLY BEEN EXECUTED, THE RESULTS MAY HAVE UNDER- OR OVER-COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN.