Over my last 16 years of research, one of the most asked questions is should you not take trades before an earnings release. I could never answer this question because I did not have the data. I can easily recall trades were a stock came out with poor earnings and crashed 25%. But without testing this, I would still take stocks into earnings. Because that is how the testing was done.

A few months ago, I discovered that Quantopian has data for the earnings dates for stocks. I had been looking for a good reason to try out Quantopian and this looked like a good project.

A large dose of salt

Before I get into the details of the test, I must clarify one thing. I am not an expert Python programmer, which is the programming language you use in Quantopian. I have only been coding and using Quantopian for a few months. I did as many checks as I could on my code. But there is a larger than normal chance that there is a bug in my code. So as always verify these results yourself before using them for trading. You have been warned.

For you Quantopian experts out there. If I say anything wrong or could have done something better, please correct in me the comments below.

​Free PDF: Mean Reversion Strategy ​Subscribe to my newsletter to receive regular updates and tips on trading and get instant access to the rules to a mean reversion strategy with results from 2003. envelope SUBSCRIBE & GET PDF



The Earnings Data

Quantopian provides free data from 2007 to 2013 on the earnings release date of stocks. I figured this gives a larger enough test timeframe to see if avoiding earnings was a good or bad thing.

Quantopian Information

Quantopian works very differently in some respects to how AmiBroker does. Because of this, some rules and stats will differ greatly from what you have normally seen in previous posts. Here are some differences.

Quantopian does not have S&P500 constituent data. They have data that they call the Q500US which is the 500 most liquid stocks. To read more go to The Q500US and Q1500US.

Entry and exit are done on a particular one-minute bar, starting with the 9:32am bar. That is what I will using.

Running a backtest is slow compared to AmiBroker. One test takes about 30 minutes vs. about 20 seconds in AmiBroker. Because of this, I was limited on the ideas I could test.

The Base Test

Since most questions about earnings have come from mean reversion traders, that is what I will be testing.

Dates: 1/1/2007 to 12/31/2013

Buy Rules

Stock is member of the Quantopian 500.

The 2 period RSI crosses under (1, 3, 8)

The close is above the 200-day moving average

Rank signals using 100-day Historical Volatility from high to low

Entry is on the next day on the 9:32 bar

Sell Rules

The 2 period RSI is over 80

If in position above 15 days, exit.

Exit is on the next day on the 9:32 bar

Base Results

I am not trying to create a great strategy but to have something to compare against.

The results are nothing to write home about.

Avoiding Earnings

Since a typical mean reversion trade is about 7-8 days. Here are the additional rules

Buy Rule Addition

Next earnings date is over 7 days away

Sell Rule Addition

If earnings are in two days, get out on the next day. We exit the day before earnings.

Results Avoiding Earnings

More Data

I have said this before but I just love results when they surprise me. I was expecting slightly worse CAR with a slightly better drawdown. In two of three cases the CAR came down dramatically while in all cases the drawdown and Sharpe Ratios got worse.

Spreadsheet

No spreadsheet with this post. Mostly because Quantopian does not make it easy to get data out.

Final Thoughts

Given these results, I will continue to trade my mean reversion strategies through earnings releases. This is why I test. My guess on what the results will be are often wrong.

One possible future test is also to avoid stocks shortly after earnings on the theory that stocks selling off after poor results will continue to sell off.

My next post will be a mini-review of Quantopian. Short preview: I will still be using AmiBroker for my backtesting.

Backtesting platform used: Quantopian

Good quant trading,

Share this: Tweet





Pocket

