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.
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.