Report not found

There was a problem finding this report.

Report

Query 1

Query 2

Query 3

Created in the Mode Community
July 25, 2016 · Refreshed 10 months ago
Sell in May
Description
An analysis of the "Sell in May and Go Away" investment strategy.

Collaborators

Run History
SELECT date, adj_close AS close FROM ptweir.s_p_500
SELECT date, adj_close AS close FROM ptweir.s_p_500
SELECT date, close FROM tutorial.aapl_historical_stock_price
SELECT date, close FROM tutorial.aapl_historical_stock_price
SELECT date, close FROM tutorial.aapl_historical_stock_price WHERE date ILIKE '%5/10/%' OR date ILIKE '%5/11/%' OR date ILIKE '%5/12/%' OR date ILIKE '%11/10/%' OR date ILIKE '%11/11/%' OR date ILIKE '%11/12/%'
SELECT date, close FROM tutorial.aapl_historical_stock_price WHERE date ILIKE '%5/10/%' OR date ILIKE '%5/11/%' OR date ILIKE '%5/12/%' OR date ILIKE '%11/10/%' OR date ILIKE '%11/11/%' OR date ILIKE '%11/12/%'
<div class="mode-header embed-hidden"> <h1>{{ title }}</h1> <p>{{ description }}</p> </div> <div class="mode-grid container"> <div class="row"> <div class="col-md-12"> <p> The <a href="http://www.investopedia.com/terms/s/sell-in-may-and-go-away.asp">Sell in May and Go Away</a> strategy of investing encourages investors to sell stocks in May and return to the market in November. It does have a catchy name, but upon analysis, it is no better than "Buy in June and Sell in December," a strategy that I just made up. There is almost universal agreement among economists that following this kind of advice actually results in lower returns. Nevertheless, I thought it would provide a fun example problem to work through. </p> <p> To answer whether or not Sell in May is a good strategy we first need to choose a data set. Mode Analytics provides a <a href="https://modeanalytics.com/tutorial/tables/aapl_historical_stock_price">SQL database</a> of Apple's stock price from 2000 to 2014, so let's start with that. </p> <p> Next, we need to formalize the strategy so that we can quantitatively compare it to alternatives. I decided to test all strategies of the form {buy on caledar date <em>A</em>, sell on calendar date <em>B</em>} every year. (If either date is a weekend, you would of course have to wait until trading opens on the following Monday.) Clearly the Sell in May strategy is really a subset of this set of investment strategies, so we will be able to test it against other similar approaches. </p> <p> To make our discussion concrete, let's take a look at one such strategy. In the figure below, I have plotted Apple's closing price for the entire year of 2000. Let's suppose that our investor's strategy is to buy on January 12. This investor is pretty lucky, because that is the day Apple's stock reached its lowest point in the first quarter of 2000. I've shaded the background pink for all the days when selling would result in a loss. The blue background indicates when the sale would result in a gain. The background is white before January 12, because you can't sell a stock before you've bought it. We'll come back to this point in a bit. Now, we can immediately see that any strategy of the form {buy on Jan. 12, sell on Oct. <em>X</em>, Nov. <em>Y</em>, or Dec. <em>Z</em>} would have been a pretty bad strategy, because after trading closed on <strong>Thursday, Sept. 28, 2000</strong>, Apple <a href="http://money.cnn.com/2000/09/28/technology/apple/">announced</a> that its earnings were far below expectations, leading to a huge drop in its stock price. (Note, if you hover over any of the following plots with your mouse, greater details should appear about the underlying data.) </p> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_31cabad484de" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <p> The plot above allows us to evaluate the performance of a single family of strategies, all sharing the same buy-on date, but we will need a more compact representation to look at more strategies for multiple years. Below is a somewhat more complicated plot, but one that is much more informative. The horizontal axis encodes the buy-on date for each strategy, and the vertical axis encodes the sell-on date. Hence, the family of strategies {buy on Jan. 12} that we investigated above is represented by a single vertical column in this figure (indicated by the black box). Going from bottom to top along that column, we see that at first the background is white, corresponding to the white background of our first plot. These are the strategies that would involve selling before buying. Next, the background becomes blue, staying mostly blue through the end of September, before going deeply red on Sept. 29. As expected, this pattern exactly mimics the time course in the first plot.</p> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_33eba233ad4f" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <p> Now we have a way to quickly visualize the outcome of many different strategies for a single year. There is a problem, though -- we still do not have an answer for the Buy in May and Go Away strategy. To evaluate it, we will fill in the bottom right corner of the figure with data from the previous year. Because our dataset only contains data from 2000 onward, we will need to look at data from 2001 to see a full figure:</p> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_3debab761901" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <p> The intersection of the black boxes represents all of the {buy in November 2000, sell in May 2001} strategies. We see that they performed relatively well in 2000-2001, because the investor would have avoided losses from the precipitous decline in Apple's stock value on Sept. 29, 2000.</p> <p> So far we have only been looking at the first year in our data set. Let's evaluate how well all of these strategies would perform if applied uniformly over the entire study period (2000-2013). Below we plot the returns that an investor would have received on an initial investment made in 2000, if every year s/he bought Apple stock on one date and sold it on another, until 2013.</p> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_19f12c4835ea" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <p> The first thing to notice is that the scale of returns is completely different -- with a little luck our investor would have multiplied his/her initial investment by a factor of 20. To emphasize this point, I have changed the color scale to green, representing money! This result confirms that holding investments for longer time periods is a good thing.</p> <p> The second clear result is that the Sell in May strategies, indicated by the box, do not seem to perform any better than other similar strategies -- the box is not much darker than surrounding regions in the figure.</p> <p> So what strategies would have been winners? Broadly speaking, we can see that in the upper-left half of the figure, the shade gets darker as you get closer to the top-left corner. These are the strategies of buying early in the year, and selling late in the year. That is, holding the stock for a long portion of every year. In the lower-right half of the figure, we see a trend towards greater returns as you approach the diagonal line. That region represents the strategies of buying just after the sell date -- again we see the trend that holding stock for a long period of time yields higher returns.</p> <p> To examine the effect of holding stock for different periods of time, below I have plotted the same data, but this time looking at the average behavior for all strategies that hold the stock for the same number of days each year.</p> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_aad211bfa19e" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <p> We can see that there is a clear trend of larger total returns when the investor spends more time invested each year over the entire study period (left plot). Indeed, on the right side, we can see that there is a strikingly linear relationship between the number of days the investor holds the stock every year and the yearly returns. (Side note: As expected, if you bought and sold on the same day every year, you would have experienced zero gains or losses, so your investment's value would have remained at a constant 100% of its original value.) </p> <p> Of course, there are some caveats to generalizing our observations. First, I assumed that between selling one year and buying the next the investment earned zero interest, which is actually a pretty safe assumption given today's low interest rates. Second, the preceding analysis was focused on one (highly successful) company. It is of course preferable for individual investors to hold a diversified investment portfolio. To look at a larger data set, below I have plotted results for an identical analysis based on investing in the Standard and Poor's 500 stock market index. I downloaded data from <a href="fincance.yahoo.com">Yahoo Finance</a> for the period 1950-2015. Again, we see that the longer an investor spends in the market the better, beating any market timing strategy handily. </p> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_7c69beac950a" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_08e4a9515edb" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <p> In conclusion, the best strategy would have been the old "Buy and Hold" strategy that encourages investing as early as possible, and holding your investments for as long as possible. Perhaps the best rhyming saying we could follow is simply, "Don't Hesitate and Ponder, Hold Your Investments Quite a Bit Longer."</p> <p><center>&#9632;</center></p> <p style="color:gray"><b>Disclosure</b><br />Nothing in this article should be construed as tax advice, a solicitation or offer, or recommendation, to buy or sell any security. This article is not intended as investment advice, and I do not represent in any manner that the circumstances described herein will result in any particular outcome. Past performance is no guarantee of future results.</p> </div> </div> </div> <script> $("#python_33eba233ad4f .chart-content").css("height",450) $("#python_33eba233ad4f .mode-python").css("height",450) $("#python_33eba233ad4f .mode-python").css("max-height",450) $("#python_33eba233ad4f img").css("max-height",450) $("#python_3debab761901 .chart-content").css("height",450) $("#python_3debab761901 .mode-python").css("height",450) $("#python_3debab761901 .mode-python").css("max-height",450) $("#python_3debab761901 img").css("max-height",450) $("#python_19f12c4835ea .chart-content").css("height",450) $("#python_19f12c4835ea .mode-python").css("height",450) $("#python_19f12c4835ea .mode-python").css("max-height",450) $("#python_19f12c4835ea img").css("max-height",450) $("#python_7c69beac950a .chart-content").css("height",450) $("#python_7c69beac950a .mode-python").css("height",450) $("#python_7c69beac950a .mode-python").css("max-height",450) $("#python_7c69beac950a img").css("max-height",450) </script>
{{ dataSourceName(params.queryId) }}

The dataset is too large to view in browser

Export

Looks like something went wrong with your query. Get help here.

{{ DS.queryRuns[params.queryId].errorMessage }}
This query was cancelled