Mebane Faber Relative Strength Strategy with MA Rule

This is a synthesis of two methods

Relative Strength Strategies for Investing
Asset Class Momentum - Rotational System
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1585517

A Quantitative Approach to Tactical Asset Allocation
Asset Class Trend Following
Mebane Faber's MA Rule
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=962461

I think it's pretty common and Mebane probably has published this somewhere.

  1. Measure the M-month trailing returns of a basket of stocks
  2. Rank the stocks and buy the top-K if monthly price > 10-month SMA.
  3. Else, hold cash

It reduces the drawdown of the relative strength approach.

Clone Algorithm
1088
Loading...
Backtest from to with initial capital ( data)
Custom data:
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Information Ratio
--
Benchmark Returns
--
Volatility
--
Max Drawdown
--
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
Information Ratio 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
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.
21 responses

That's a very nifty example of the batch transform, too. I have to look more into this one! Thanks.

The idiom of placing orders to close the gap between the current portfolio and the target portfolio is a great one as well.

Oh, you guys

(blushing)

Thanks

That's really interesting, Simon. I wonder if the peak moves or if there have been any changes throughout the years. Probably I would expect to see something after Faber published the paper in 2009.

Also, I think I posted this to the wrong system -- those results were for the simple MA crossover, nothing to do with the relative strength. In any case, yeah, interesting stuff. I will do some more tests tonight to see how a (lower resolution) heatmap changes over rolling time periods to see if there was a measurable difference after publishing.

Simon, in the heat map, how is the color scale working? blue is better returns?

In this case red is better, I am going to double-check and do some more of these tonight...

I double checked the numbers and reimplemented a couple of different ways to be sure. Never got around to the rolling analysis, probably tomorrow.

Tried briefly to reproduce quantopian's risk numbers, but I posted a separate question about that!

Nice. It seems like optimum has shifted to 50/100 (from 20/200)

Yeah -- also note that returns in 2006-2009 period were bad as well, it's just hard to tell because the color scale is changing from subplot to subplot. New ones I do will use a common coloring, but I had to go to bed before I got that working properly!

Hi - I just tried playing around with this and discovered that a recent performance optimization has caused a problem with np.log(datapanel['prices']). We are working on a fix!
thanks,
fawce

I simply "cloned" and then built it and am getting an error I can't understand:

AttributeError: log
... USER ALGORITHM:16, in trailing_return
pricedf = np.log(datapanel['price'])

Hi Dan,

We just found and fixed the issue, just working on getting the fix to production. What happened is that we did a performance optimization after this algo was shared. Our change inadvertently lost some of the type information for the data sent to the batch transform during simulation. Should be sorted very soon.

thanks,
fawce

https://www.leinenbock.com/cheese-and-etfs/

independent backtest (in python)

Thanks John, for sharing this alog. It's really well implemented, some great programming features. I almost feel a bit conscious now about my own version (see Simon's post above), that I've just coughed up quickly for a friend. What I found was that this strategy gives quite stable and consistent returns with a range of different securities and it really surprised me. In terms of slow moving strategies, this one of the better ones I've come across so far. Considering how slow it is, it wouldn't even require automated execution. The perfect superannuation strategy :-)
Because of the initial spec, In my code I used weeks rather than days as look-back periods which increased the complexity of the coding enormously. Any ideas on how to simplify that?

Hi John,
Thank you for sharing this algo. I like the way you implemented it, very compact and efficient. It does make it difficult for us newbies to understand but then efficiency is more important in my mind.

Can you implement a disaster stop loss in the system? Say if a stock drops more than 15% from its purchase value, it gets sold, and won't get bought unless another stock is bought first. This way, if the whole market is tanking, and that stock is still the leader, it will prevent the system from continuously buying and selling that stock.

Thank you,
Maji

Question for you all. Seeing this perform so well in back testing, what are your hesitations when actually taking this algo live?

Chase,
The market is really efficient. Do you see the plethora of Sector Rotation Systems out there now? It means that the market will digest these strategies soon, if not already, and the advantages will diminish and/or go away. So, I think the return going forward will be less than the back test. You can already see some of the Sector Rotation systems plateauing out.

A classic example is the Opening Range Breakout (ORB) System. When it was first disclosed, it was doing great. Then the market absorbed it and the opening range was slowly expanded from 1/2 hour to an hour to sometimes till lunch time, depending on what system you were looking at. Once people get tired of the system and abandon them, they slowly regain their effectiveness again.

That is the reason why I want a stop loss built into this system so that if it collapses, we don't lose everything.

I hope we have some good discussion on your question.

Hi John:
I have just read the original paper - for a long time, I have been a Dollar Cost Average investor - basically been buying the same stock over 10 years and I have always stayed way above the SMA - have you come across any comparison between DCA and Relative Strength Strategy? I am very curious to know this before changing my strategy.
San

How do you implement this strategy with Set_Universe()? I tried but it didn't seem to work because of the way the data is formatted in the @batch_transform.

Thanks.

I made a version of this that uses the history function so it can be used with minute data. It seems to work but has some long drawdown periods. I'm sure it can be improved with a few adjustments. The results are pretty close to the daily data version.

Loading...
Backtest from to with initial capital ( data)
Custom data:
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Information Ratio
--
Benchmark Returns
--
Volatility
--
Max Drawdown
--
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
Information Ratio 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
There was a runtime error.