Berkshire Hathaway trading strategy

This is a Berkshire Hathaway trading strategy which would have given almost ten times the return performance of buy/hold over the last 10 years with half the drawdown. The strategy is detailed in the table below, it was straightforward, with 123 trades over the 10 year backtest period. All trading was done at the weekly close of business. This was a strategy where there was usually a buy and a sell signal every week (398 out of 528 weeks), but selling was initiated by the presence of a sell signal and an absence of a buy signal. There was a strong buy bias, appropriate for the underlying positive trend of the stock.

Equity curve, signals and positions are shown in the growth chart below. Notice the preponderance of white signals which indicate dual signal days.

If the sell point was set at zero percent, the algorithm gave positive results for all buy points greater than 0.25%. Below we show how return varies with buy and sell parameters.

The returns for every combination of buy and sell parameter are shown in the surface plot below.

Looking at the minimum annualized returns for each of the four 132 week periods, you can see that the algorithm was much better behaved than the underlying stock, worst case was 19.26% which happened in the most recent quartus. The long side of the algorithm showed a min return of 15% with a stddev of only 3.37%, which is quite tight.

As always, this is not a recommendation to trade using this algorithm, just an interesting backtest result. For a list of trades, see here: BRKA.W Trades.

Please note, the above result was corrected 12/28/2015 to address a bug fix in the short side calculations.


Update Oct 21st 2016

 

BRK-A Trading Strategy (Weekly) Update 10/21/16

BRK-A Trading Strategy (Weekly) Update 10/21/16

GOOGL Trading Strategy (Weekly)

Here is a Google Inc (GOOGL) trading strategy with once a week intervention which would have performed significantly better than buy-hold over the last 10 years. Annualized return was 31.5% vs. 16.5% (returning $149K for 10K outlay vs $36.7K, compounded), drawdown was 40.2% vs. 62.4%, so reward/risk was better.

The buy and cover signal (see table below) was present every week where the price dropped 0.03% below the last price the stock was sold at which happened 174 times over the course of the 528 weeks of the analysis, and usually happened the week following a sell/short.

The sell and short signal happened every week the stock price rose 8.13% or more above the open price of the current week. This happened only 29 times, so there is a strong buy-side bias to this strategy. All trading would have been done at the open of the week following the signal.

The equity curve for this GOOGL trading strategy shows that the stock was held short (the red bands in the background) for small periods, typically a week.

The scan below shows how the annualized return changed, had the buy and sell parameters changed. At 2.35% buy point, the algorithm gets stuck, resulting in a loss. This is characteristic of trading strategies which reference buy or sell prices. At 1.5% sell point and below, the algorithm made a loss, but returns for all buy points above that were positive, for the 0.03% buy point.

One nice characteristic this algorithm had was consistent returns for each of the 132 week  periods in the backtest. You can see from the table below that the annualized return was between 28% and 34.8% for every period. Compare that with buy-hold which ranged from -4.6% to 26%

You can also see this characteristic on the scans for each quartus:

You can download the list of trades in .xlsx format: GOOGL.W Trades.

As of Sept 16th 2015, the algorithm is long, awaiting a sell signal if the price hits 708.933. Last sell price was 654.34.

Please note, while this is an interesting backtest result, it is not a suggestion to trade this way. As always I don’t know how this strategy will fare in the future, but will track it from time to time.

Andrew

This post was edited 12/28/15 to correct an error in the short-side returns.


Update Oct 21st 2016

This strategy has pretty much followed buy-hold long:

GOOGL Trading Strategy Update Oct 21 2016

GOOGL Trading Strategy Update Oct 21 2016

DIS Trading Strategy

Here is a Walt Disney Company (DIS) trading strategy with daily maintenance which had quite nice characteristics; 59% annualized return over the last 2 years.

DIS trading strategy, equity curves, signals and positions.

The performance was better than long buy-hold with lower drawdown and about three times the reward-risk. Signal reinforcement was good, and not many dual signal days.

DIS trading strategy (daily), and performance characteristics over the last 2 years.

Below I show the return for the DIS trading strategy for each 6 month period going back 2 years. Comparing with long buy-hold you can see better consistency (higher minimum and lower StdDev).

DIS.D Longevity Corr1

Please note that this is simply a measurement, not an opinion or financial advice.

This post was corrected 1/8/2016 to correct a miscalculation in the short-side returns.


Update Oct 21st 2016

Strategy peaked 11/23/15, shortly after the stock price peaked.

DIS Trading Strategy (Daily) Update Oct 21st 2016

DIS Trading Strategy (Daily) Update Oct 21st 2016

Two GLD Trading Strategies (Daily)

GLD is the much traded SPDR Gold Trust ETF. I find these two GLD trading strategies interesting because they gave reasonable results (32.6% and 48% annualized return) for each of the four 6 month periods of the analysis. The strategies require daily intervention.

Strategy 1: BCS AHC

This is a buy on fall, sell on rise strategy using the close price as the buy reference and the high price as the sell reference. As you can see from the life chart and the longevity analysis, the lowest return for the last four 6 month periods was close to 30% annualized. You can easily find algorithms with over 50% annualized return for GLD, but they are not as consistent, with lowest quartus returns of around 14%.

I would prefer to see more reinforcement on the signals, but there it is. As of Sat Sept 5th, this strategy is Short with no transactions pending.

You can view the trades in spreadsheet format here: GLD.D Trades

Strategy 2: AOO AHCI

In many ways this strategy shows better results than the BCS AHC strategy, for example there was lower drawdown, higher return, better signal reinforcement and good consistency (minimum 6 month quartus return of 38.43%). On the other hand, signals were cluttered, with 67 dual signal days, 50 buy signal days and 75 sell signal days. Also, its not an trading strategy that makes intuitive sense; buy on rise, sell on rise. Maybe it is one of those serendipitous occurrences, we shall see. Notice the sell strategy is almost the same as for BCS AHC but the sell signal percentage is quite different.

As of Sat Sept 5th, the strategy is Short with no transactions pending. GLD.D2 Table GLD.D2 Longevity GLD.D2 Surface GLD.D2 Life GLD.D2 Time For a list of trades in Excel format: GLD.D2 Trades. For a more detailed explanation of the above charts, please go here.

Algorithms were discovered by SignalSolver.

Please note, the above analysis was corrected on 12/28/2015 to reflect a bug fix in SignalSolver. Original returns were $9530 and $12753 respectively.


Update Oct 21st 2016

Both algorithms peaked 12/30/2015.

GLD Trading Strategy AOO AHCI Update Oct 21st 2016

GLD Trading Strategy AOO AHCI Update Oct 21st 2016

GLD Trading Strategy BCS AHC Update Oct 21st 2016

GLD Trading Strategy BCS AHC Update Oct 21st 2016

TSLA Trading Strategy (Daily)

This TSLA trading strategy would have given a 1062% return over 2.1 years vs. a buy-hold return of 86% for the same period. The strategy is based on buying and selling when the stock price rises above specific thresholds. The buy side keyed off the day’s open price; the buy and cover signal appeared when the price rose 4.27% above the open price of the day, and the buy is at the signal price, so you would have to set up stop orders for the buy and the cover.

The sell and short signals came along when the price rose 2.82% above the previous day’s high, and the sell actions occured at the subsequent open using market orders. Every day you would have to recalculate the buy or sell point to find the new buy or sell price. SignalSolver will re-calculate the prices each time you update the prices from the web or enter the latest prices manually. Here is the list of trades.

The equity curve shows the return of $10,000 over time for the algorithm (yell0w) and buy-hold (gray):

This algorithm spent 64% of its time short. Looking at the signals at the bottom of the chart, you may notice that they are fairly thin, and there are 21 dual signal days, 28 buy signal days and 36 sell signal days. There is occasional reinforcement of signals, OK but not great.

From the performance table you can see that the long side of the algorithm worked much harder than the short side (the leftmost two columns), but the combination (always being long or short) gave annualized return of 223%.


Lets look at sensitivity to the buy and sell parameters.

The dotted line is buy-hold annualized return at 34.45%. The colored lines are the return for different values of buy and sell percentage in different time periods. The blue line is the overall performance for the whole 2.1 year period (528 daily data points), the other green, red, yellow and white lines each represent one quarter of the data (which I call a quartus). As you move the buy or sell point out of the region, you can see that some quartus’s would have been lossy. The worst performing quartus for the chosen buy and sell points was the most recent one, 02/19/15 to 08/26/15, and the annualized return was 161%. The algorithm was found by instructing SignalSolver to find strategies with the best minimum quartus return.

If you map the return for a large range of buy and sell points you notice that the overall surface is a little peaky.

While there is a fair amount of space under the peaks, there are also steep cliffs in the vicinity, so if the buy and sell points were to move around over time you would be in trouble. For that reason I would not expect such high gains in the future.

I will be paper trading this strategy for a while and will post the results from time to time.

Andrew

 

The above analysis has been corrected 12/29/15 for a bug in the short side return.


Update 12/29/2015:

TSLA.D Update 12-29-15


Update Oct 21st 2016

TSLA Trading Strategy (Daily) Update Oct 21st 2016

TSLA Trading Strategy (Daily) Update Oct 21st 2016

TSLA Trading Strategy (Daily) Update Oct 21st 2016

TSLA Trading Strategy (Daily) Update Oct 21st 2016


 

TQQQ Trading Strategy (Weekly)

Today I present two TQQQ trading strategy backtest results with weekly setup with similar reward-risk but very different characteristics. TQQQ is the ProShares UltraPro QQQ, a triple leveraged ETF tracking the Nasdaq. The backtests were for the 288 weeks 2/11/10 through 8/14/15.

The first trading strategy was found by optimizing the scanner for low drawdown, (per Prasad’s request):

Backtest results for weekly TQQQ trading strategy showing low (8%) drawdown. The backtest is for the period 2/11/10 to 8/14/15.

This strategy gave similar return to buy/hold with much lower drawdown (8% vs. 41%). It only spent 42% of the time in the market, so it was quite efficient. The user defined price is found by averaging the open price of the current week, the previous week’s low price and the previous week’s high price. Here is the equity curve:

Equity curve for the low drawdown TQQQ trading strategy backtest. Return is about the same as buy/hold.

These results were corrected 1-4-2016 to fix the short-hold return.

The second TQQQ trading strategy backtest was found by optimizing the SignalSolver scanner for returns:

This is a long & short strategy when you are were always in the market either long or short. The equity curve shows that this was not a frequent trader, in fact no trades since Dec 2011:

List of trades: TQQQ.W RR .

Andrew

Please note: All trading strategies are backtested on a single security and will typically not give similar results on other securities. All returns are compounded. Trading costs are assumed to be $7.00 per trade with zero slippage.

The posting was corrected 12/29/2015 for an error in the short-side returns of the BMS ACO algorithm.

Update 10-20-2016

BMS ACO has continued to track buy-hold with no trades adding 7.45%.

TQQQ Trading Strategy Update Oct 20th 2016

TQQQ Trading Strategy Update Oct 20th 2016

This strategy peaked 11/30/2015.

OMER Trading Strategy (Daily)

Frequent reversals characterize this strategy for Omeros Corporation

This OMER trading strategy is signal rich; there were 174 dual signal days out of the 528 days in the analysis. Added to that 151 buy signal only days and 39 sell signal only days and you get 364 signal days, of which 250 were actionable signals leading to trades, of which only 146 were good. Still, all that activity led to a theoretical $311,341 profit from $10K invested over the 2 year period from 7/12/13 to 8/14/15.

The algorithm itself is a bit of an odd one with buys triggering off price changes from the open price and sells triggering off price changes from the previous day’s open price. Is it just a fluke that it has worked so consistently? In its worst quartus (132 trading days in this case) this algorithm returned 250% annualized or 93% actual return.

You can see from the list of trades and the equity chart that there were several periods of daily reversals from long to short and back again. You might think that ignoring dual signals would work better, but it doesn’t–it leads to an 80% reduction in returns.

This strategy was found by optimizing for minimum quartus returns and then doing some minor tweaking by hand, which is quite easy to do since the Scan charts in Signalsolver are interactive. I just moved the buy and sell points to areas away where there were lower returns. I’m just going to post the charts, if you need help interpreting them I would refer you to yesterday’s AAPL post where I discuss the methodology in detail.

By the way, OMER took off today gapping up 70% or so. I was working on it before that so this change doesn’t show on the data, but the proceeds would have jumped to $929,212. It would be cheating to track this strategy knowing it had already added 70%, so I’m not planning on doing so.

Andrew

OMER.D Time

Equity curve for the OMER trading strategy showing $545,057 in returns over a 2 year period.

OMER Daily Trading Strategy, sync up info

OMER Daily algorithm–current and pending trades, if you are looking for synchronization info.

Follow up 12/29/2015

This algorithm peaked and then failed dramatically immediately after the 70% gap up on Aug 18th, very shortly after publication. Here is the 528 day equity curve:

OMER.D Equity Followup

Here are the stats:

 

OMER.D Table Followup

Buy-hold would have been a much better option. For a profit, one solution was a buy point of 2.0% and a sell point of 4.4%, which would have given a return of $13,964 over the 94 days. Unfortunately, these parameter changes don’t appear to be predictable.

Andrew

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

UWTI Trading Strategy (daily)

This UWTI trading strategy would have returned $676,147 for $10K outlay over a 2 year period. It was a very straightforward strategy with simple maintainence, once a day you would have put in either market orders to cover and buy or stop orders to sell and short before the open. This is another result discovered by optimizing minimum quartus returns, a SignalSolver backest optimization technique. A quartus is one-fourth of the data and we look for algorithms which give the best minimum return of all four quartus results. In this case it was 206% annualized for the period June 2013 to Jan 2014. It happened to be the fourth best result found for this particular scan of 500 algorithms but I chose it because the drawdown was significantly better than for the other 3 (30.7% vs 55% for short-hold).

Results for this strategy were not consistent, most of the gains were made in the period June 2014 to Feb 2015.

UWTI-D Table

UWTI-D Equity

UWTI-D Life

UWTI-D Scan

UWTI-D Surface

A list of trades in spreadsheet format: UWTI-D Trades

Update 12-30-2015:

The above analysis has been corrected for a miscalculation of the short-side return of this algorithm.

UWTI-D Table Update1

UWTI-D Equity Update1

Update 10-20-2016

This algorithm turned a complete loss:

UWTI Trading Strategy Update 10-20-2016

UWTI Trading Strategy Update 10-20-2016

TNA Trading Strategy (Daily)

In contrast to yesterday’s TNA trading strategy optimized for low drawdown, this one is optimized for minimum quartus annual return, a new feature of SignalSolver. A quartus is one quarter of the data, 132 days in this instance, and the minimum return was 99% annualized for the most recent quartus Feb 3 to Aug 11th 2015.

You can see how quartus annualized returns fluctuate with buy/sell parameters from the lifetime graphs. Note that this algorithm took both long and short positions–when you were not long, you were short. I have no idea how or why this kind of algorithm works–you would think the buy and sell signals are so similar that it would give more random returns, but you can see from the surface plot that the results are positive for most of the parameter space.

The “user defined price” was found by averaging the previous day’s high, the previous day’s low and the current day’s open price. Buying and selling was done at the daily close or next day’s open.

TNA-D Table

TNA-D Equity

TNA-D Life

TNA-D Scan

TNA-D Surface

 

List of trades in .xlsx format:  TNA-D Trades

 

Update 8/26/2015

Trades since the original backtest endpoint on 8/11/2015:

TNA.D2 Update 8-26-15

Update 12/30/2015

The above analyses have been corrected for an error in the short-side returns. Overall gain of the original erroneous post was $104,971

Here are the updates for 12/30/15. The algorithm peaked around Oct 13th and now appears to be failing:

TNA-D Equity Update 12-30-15

TNA-D Table Update 12-30-15

Update 10/20/2016

A bit of an improvement:

TNA Trading Strategy Update Oct 2016 Equity

TNA Trading Strategy Update Oct 2016 Equity