Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Value Momentum and Trend following

I’ve been exploring the benefits of adding a managed futures strategy to the ROBUST Value/Momentum strategy I discussed in this post. To that end I implemented the 50 day breakout strategy described in Andreas Clenow’s book ‘Following the Trend’. The strategy was implemented on another trading platform, however I was able to import the results into a research notebook and integrate them with the returns of the value momentum strategy.

I thought the results as well as the technical details of importing the results and combining them with a Q strategy would be interesting to folks on the forum so I’ve published the notebook.

In my opinion the results are interesting from a portfolio management perspective since they illustrate how the risk adjusted returns of a portfolio can be improved by combining two uncorrelated strategies. The Sharpe ratio of the combined strategy is 1.01 as opposed to .84 and .72 respectively for the Value/Momentum and Managed Futures strategies. Also, looking at the monthly and annual returns charts the combined strategy has much smoother returns and doesn’t lose money in any year. On the other hand I’m not sure the smoother returns would necessarily make the strategies easier to trade since the managed futures strategy is quite volatile and has some impressive one day swings.

Lastly, I included analysis for a restricted version of the managed futures strategy that only trades currencies and e-mini contracts. This is perhaps a more realistic strategy for smaller accounts. The returns to this strategy are reduced but the diversification benefits are similar.

With respect to cloning the notebook, I suspect it won’t work because it relies on data uploaded to my local data directory.

7 responses

Updated the notebook to make it a little more readable.

Sorry for the slow reply but I think this way of analyzing multiple versions of an algo using pyfolio functions in this way is very elegant. This post inspired me just today to an analysis in a very similar way. I'm wondering if more multi-algo functionality should be added to pyfolio. Anyway, thanks for sharing!

Disclaimer

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.

Thanks Thomas, appreciate your response. One thought I had was that exposing some of the functionality in the Pyfolio Utils library would allow for inclusion of a benchmark in some of the graphs.

Mark, that should already be possible with the factor_returns kwarg: https://github.com/quantopian/pyfolio/blob/master/pyfolio/plotting.py#L589

@Mark - I like your research and am very familiar with Andrea's work. Do you have a version of the code you used? I didn't see it in the notebook.

@Thomas, thanks will have a look.

@Daniel,

The value/momentum algorithm is here. The trend following algorithm is an implementation of the 50 day breakout strategy described in Andreas Clenow's book Following The Trend. It is implemented in Tradestation because I happen to have access to that platform and so could get data for the instruments traded. However I wouldn't recommend the platform for doing this kind of thing, it is not designed for portfolio based algorithmic trading so I had to write quite a bit of custom code to manage the portfolio and even some AutoIt scripts to automate execution. Also, my implementation is not an exact replica of Andreas' system since I did not have data for all of the instruments he trades in his book, but the results I obtained were reasonably close.

Mark,

We added futures to research and backtesting. Maybe you could try implementing a few of the examples that Andreas talks about with futures? Check out the announcement post for details.

Disclaimer

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.