AAPL Trading Strategy (2)

This is an interesting AAPL trading strategy for the period 12/12/80 through 7/31/15, which would have generated $8,521,705,763 in profits from $10,000 initial investment. Buy and hold would have generated $2,744,894 in profit in the same period. The cover and buy signals were generated when the stock price dropped 37.77% below the 20 month exponential moving average. Short and sell signals were generated when the price dropped 30.01% below the previous month’s high. Positions alternate between long and short. There were a total of 44 buy signals and 44 sell signals, you can see them at the bottom of the equity curve as vertical lines:

Blue/green lines are buy signals(23), red/yellow lines are sell signals (23) and white lines are dual signals (21). A dual signal always leads to a trade, but a buy signal would only lead to a trade if you were short, and a sell signal would only lead to a trade if you were long. So you can see there was some nice reinforcement on the signals.

The AAPL trading strategy and its performance

Selling/shorting was done at the next month’s open using market orders, while buying/covering was done when the signal arrived using limit orders. The green and red backgrounds behind the equity curve shows if you were long or short. The rules governing the strategy are shown in the performance table below. Signals are straightforward and response to signals is also simple.

Had you been lucky enough to have been following this AAPL trading  strategy, you would have needed to check in on it only once a month before the monthly open to place orders, a few minutes work. Only 39 of the orders placed actually executed as you can see from the Performance Table:

A few points about the Performance Table; In the Messages section you can see some warnings about the way the stock price moved. SignalSolver warns you about price jumps so you can check them out. In this particular case the jumps were for real–one drop in Oct 1987 (Black Monday), the other a drop in Sept 2000 as the dot com bubble burst.

The Performance Table also tells you how you would have fared if you had only played the long side (i.e. never gone short), or if you you had played the short side and never gone long. Clearly, playing both long and short (the L&S Column) sides was a better strategy in this instance, however you would have lost everything if the buy and sell points were not exactly as described.

Drawdown is the most you could have lost if you had entered a strategy at the worst possible time and then stopped using the strategy at the worst possible time. Notice the drawdown for the trading strategy was 61.6%. This may seem extreme, until you look at buy and hold drawdown of 79%.

Efficiency (relevant only for the long only and short only sides of the trading strategy) tells you the annualized return if you had invested at the same rate when you were not holding AAPL long or short. Its the annualized return divided by the % of time in the market. Reward/risk is the annualized return divided by the drawdown plus a 5% offset.

Figure of Merit is what the optimizing backtester uses to grade each of the algorithms. It can be set up to look for a rich variety of attributes like total return, drawdown or efficiency. In this instance we compared around 47,000 algorithms with about 13 million backtests optimizing min quartus return (see below).

The effect of parameter changes on return

Now we’ll take a closer look at the buy and sell parameters. Remember the strategy–buy if price drops 37.77% below the 20 month exponential moving average, sell if price drops 30.01% below the high of the previous month. Well, you need to look at the effect on return if you change those percentages. For that we look at the Scan Charts. First, the scan chart for Long and Short style.

AAPL.M2 Scan LS

This shows that the profitable sell point range was very tight, between 30 and 32 %. Outside of this was a total loss. When you compare this with the scan for the Long only strategy, shown below, you can see the extreme downside risk of short selling a stock like AAPL. This makes the Long and Short strategy too risky to consider further, however the Long only strategy, with its 35% annualized return is still interesting, so we shall focus on that. Here it is:-

AAPL.M2 Table Long

and here is the scan result:

This is a much nicer scan result than the Long & Short strategy result. Focusing on the Long only scan, you can see from the top scan that if you had got the sell percentage right but used a buy point of 42%, then you would have done much worse. Similarly, if you had got the buy percentage right but used a sell percentage of 20%, again you would have reduced the profits considerably. On the positive side, if your sell point was 30.01%, you would have done better than buy hold for any buy percentage below 41.5%. Or, if your buy % was 37.77%, then you would have done better than buy-hold for or any buy % greater than 26%. But that’s not the whole picture. You can plot returns for every value of buy and sell point in the form of a surface plot:

If you run SignalSolver, you can spin the surface plot around to take a good look for areas of low return were you could have got into trouble. The higher the hill, the more return you would have made if you were using those buy and sell points. You wanted to be high on the “hill” but not close to any cliffs as they imply risk.

The next question is how did returns change over time for different buy-sell points? To answer this we use the “Life” Scan Chart:

AAPL.M2 Life Long

The Life scans are expanded views of the Scan Chart, in fact the blue line is exactly the same graph. The other lines show how the returns changed with buy and sell parameters for other time periods. Each time period is one quarter of the entire data set which happens to be 104 months (8.66 years) for this analysis. We call this a “quartus” (latin for one fourth) to avoid the ambiguous term “quarter”.

The trading strategy was found by setting up the SignalSolver backtester to search for the algorithm with the best “worst quartus”. Effectively, its looking for space under the Life scans. In this case, the annualized return for the worst quartus was 17% for the red period (8/1/89-3/2/98) while the best quartus was 53% ann. return for the yellow period (4/1/98-11/01/06). So while the return is nowhere near the highest returns I have found for an AAPL trading strategy, I think the (long only) strategy has better consistency and less sensitivity to the buy/sell parameters.

Note that the backtests assume a transaction fee of $7 per trade and slippage of 0%.

Here is the list of trades for the long side: AAPL.M2 Trades Long.

Andrew

Please note that there were errors in the original posting related to the short side of this algorithm. These have now been corrected (12/29/2015)

Update 10-20-2016

Strategy has followed buy-hold, losing about 4.8% since publication

Posted in Monthly.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*