Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Monthly Traded - Low Max Drawdown w/ Stock Market Like Returns

I will be starting an investment firm this year for clients that are close to retirement. The main focus will be on low max drawdowns with "stock market like" returns. Below is the best algo that I could come up with that trades monthly (credit given to CSSAnalytics & David Varadi in the source code). It is a blend of percentile channel trading (monthly) that is adjusted for by the volatility of the asset, mixed with 50% core ETF assets that do not change.

This algo looks good for the long term, however, in the last 5 years it has underperformed too much for this to be my go-to strategy. After this post, I will post the last 5 years backtest.

Goals:

  • Trade monthly or quarterly
  • Keep long term max drawdown as low as possible (under 16%, closer to 10% would be preferred)
  • Long only
  • Stock market like returns
  • Low calendar year losses
10 responses

Below is the 5 year backtest of the same strategy as above. Note the underperformance overall and in 2017, 2019.

@Max,

Thank you for redepositing Alex's "CSSAnalytics - A Simple Tactical Asset Allocation Portfolio with Percentile Channels"
Why didn't you post it on that thread?

@Vladimir,

I did give credit, as indicated above, however, I changed the algo a fair amount and I'm looking for some specific help related to my goals listed above. If anyone can help, it would be appreciated.

-- Max

Mr. Max Drawdown

FYI.David Varadi writes his algorithms in R.
So you took the satellite part of your algorithm from this thread.
I don't see you mentioning this.

Alex code in Q1

    h = history(300, '1d', 'price')[context.active]  
    hs = h.ix[-20:]  
    p = h.ix[-1]  
    hvol = 1.0 / hs.pct_change().std()  
    hvol_all = hvol.sum()  
    r = (hvol / hvol_all) * 1.0 / len(context.channels)  
    alloc = pd.Series([0.0] * len(context.assets), index=context.assets)  

Your code without comments

    h = data.history(context.active, fields="price", bar_count=300, frequency="1d")  
    hs = h.ix[-20:]  
    p = h.ix[-1]  
    hvol = 1.0 / hs.pct_change().std()  
    hvol_all = hvol.sum()  
    r = (hvol / hvol_all) * 1.0 / len(context.channels)  
    alloc = pd.Series([0.0] * len(context.assets), index=context.assets)  

What significant changes have you made to the code to call it your own?

I'm not claiming that any of this is my original idea. To the contrary, I'm trying to give credit to CSSAnalytics / David Varadi.

I've made the following changes:

  1. The channels lengths have been increased.
  2. I've added core assets, 50% of the portfolio.
  3. The entry has been increased from .75 to .90
  4. The assets have been changed.
  5. I've commented the code.

Although it is better, it's still not achieving my goals listed above. Any help would be appreciated.

-- Max

Mr. Max Drawdown,

Until you accept that you have re-deposited Alex's "CSSAnalytics - Simple Tactical Asset Allocation Portfolio with Percentage Channels"
possibly with some parameters changed and edit your first post here accordingly, I will continue to post code snippets Alex and your code.

First 6 lines of algo.

Alex code

# CSSAnalytics - Momentum Channels Alex version  
#  
# Source:  
#   David Varadi  
#   "A Simple Tactical Asset Allocation Portfolio with Percentile Channels"  
#   (https://cssanalytics.wordpress.com/2015/01/26/a-simple-tactical-asset-allocation-portfolio-with-percentile-channels/)  
#  

Mr.Max Drawdown code

# CSSAnalytics - Momentum Channels Mr. Max Drawdown version  
#  
# Source:  
#   David Varadi  
#   "A Simple Tactical Asset Allocation Portfolio with Percentile Channels"  
#   (https://cssanalytics.wordpress.com/2015/01/26/a-simple-tactical-asset-allocation-portfolio-with-percentile-channels/)  
#  

Where did you get the algorithm code?

I do really have about 200 algorithms which met all your requirements.

Like this:

I find myself quite amused here. We all source and plagiarize ideas from all over the internet. Its a dog eat dog world out there and you will not find any or much true originality. What was it Newton said about standing on the shoulders of others?

@Vladimir,

Yes, yes yes the original code came from Alex's CSSAnalytics post, I believe stemming from some of David Varadi's ideas. Not trying to hide that fact and the reason why I added / edited CSSAnalytics into the first post. Trying to obtain these goals:

Goals:

  • Trade monthly or quarterly
  • Keep long term max drawdown as low as possible (under 16%, closer to 10% would be preferred)
  • Long only
  • Stock market like returns
  • Low calendar year losses

If you would be so kind as to share one of your algorithms, that would be very much appreciated.

-- Max

@Vladimir

I agree that the lack of a clear and explicit acknowledgement of Alex's CSSAnalytics post did leave me feeling unsettled.

Given Max D's amendments made to rectify this, if your comfortable, I am really keen on learning from your insights on this algo your willing to share

@Umar Hasan,

I am really keen on learning from your insights on this algo.

I respect you as an active long time member of the Quantopian forum and am ready to discuss, but I will not do that in this thread.
Let's ask originator of this thread Mr.Max Drawdown share his insights of the code.
And why (credit given to CSSAnalytics & David Varadi in the source code) , but not to Alex?

@ Anthony F.J. Garner,

What did Newton say about standing on the shoulders of others?

If everyone who stood on Isaac Newton's shoulders behaved like Mr Max Drawdown,
we would not even know such a name Isaac Newton.
It is not clear from this thread who is the real author of the code published above.