Back to Community
Did you sell in May? Bad move!

We all saw Jess's post from last month. She showed that the "Sell in May and go away" strategy is often a profitable one - 82% returns versus 35% for the S&P 500.

Then, did you sell on May 1? If you did, you missed out on 2-3% of this nice rally. It got me thinking - is May 1st the right day? Or is it May 15th? Or later?

I modified Jess's algo so that it rebalances on May 15, not May 1. The result is even better! Over the last few years, you squeeze out a few more percentage points, up to 84% return.

So now I have a new question for everyone: What is the optimal way to run this strategy? Please clone my algo. The key controls are in line 26. Choose any month, any day - what'st the right time to get out of this seasonal rally? You can test anything you want.

Once you've think you know the answer, share it here, and start a live, papertrade of your algorithm. Track how it does going forward, and see how close you get to the peak.

Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 51958a177232be06efb7af52
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

1 response

Hi Dan,

Another way of framing the question in a general sense is to ask if there is a more generic algorithm that could be applied for finding statistically significant patterns in time series that could be run on the data, rather than trying a series of point solutions via backtesting. If the pattern recognition works, it should pick up on the "Sell in May and go away" effect, but also flag similar patterns. I see that historical prices are available for SPY from Yahoo...does anyone have suggestions for an algorithm that could be applied?

Also, I don't understand your suggestion to start paper trading of such a low frequency strategy. Would it make sense to use Quantopian/Interactive Brokers for a few transactions per year?