11 Comments

hello, interesting strategy here. Assuming you're using python. Is that backtesting engine custom or some public library?

Expand full comment

Hi! Thanks! It's a custom engine...

Many, many, many years ago, I implemented a backtest engine in Python for my master’s degree… it’s an event-driven engine (they are slower than vector-based engines, but imho they are easier to write strategies for, understand, and debug) with all blows and whistles, similar to the late Zipline. In fact, I tried most of the Python backtest engines that exist, and that’s why I prefer to use what I built over the years: I have 100% understanding of what’s happening and 100% control.

There's so many people asking about it that I'm considering sharing it :)

Expand full comment

that would be cool because the main public backtesting engines are not suited to test a strategy for several assets at once, sure you can do a for loop and a df that sums up the returns from each asset but you lose all the extra info/indicators unless you do adapt the bt engine

Expand full comment

Interesting. Could you explain what you mean by the following, the formula?

"we sort them by volatility (Normalized Average True Range)"

Expand full comment

Thanks! In the article https://www.quantitativo.com/p/robustness-of-the-211-sharpe-mean

I did a whole section about it.

Basically, we see that the higher the volatility (measured as Normalized Average True Range), the higher the expected return. So, at the beginning of every day, we sort all opportunities by their NATR (it's trivial to compute) and prioritize the higher ones to fill all available slots

Expand full comment

What would happen if you allocated 20% to managed futures/trend following/liquid alts? You might also try adding some gold. I thunk the strategy would benefit from more non-correlated assets and strategies.

Expand full comment

These are great ideas, thanks!! I'll put in the backlog to test :)

Expand full comment

excellent article man big thanks to you. Someone said add gold for diversification : i def agree with that while i haven't made the test for this strategy specifically, i know from my testings that it seems to work quite well. 7-10 years bonds could also be added to the mix as they tend to reduce equity drawdown, especially in periods of crisis, and they have low correlation with stocks in general. You could also try futures for sure (that's what i trade), but i'm not sure the added complexity will be worth it. You will def get more diversification options tho. You could also use short term bonds for protection when you enter in periods of high vol especially for your mean reversion strat as it uses high vol quantiles. I have not tested that myself yet but i wonder if adding short term bonds to the mix can reduce tail risk. I Finally : i think the next obvious path to test might be diversification of time frames (lookback, changing time series frequency, changing rebalancing frequencies), instruments, asset classes (not allowing a single asset class to dominate, and having a minimum % allocated to each asset class/ market sector), but also diversification of methods : change the way you rank momo, change the way you carry your edge for mean reversion, look at varied position size techniques and so on.

Thank you for that great contribution i'm looking forward to test this.

Side note : i'm definitely super interested in getting some python code / library from you

Expand full comment

Thanks! Your msg gave me some insights on new ideas... diversification is the way to go, for sure! In fact, your msg reminded me of Robert Carver's books :)

Btw, it's in my future plans to share some of my code... I just need to find time to properly do it. :) cheers!

Expand full comment

Improving the momo strategy... I'd try selecting from a "universe" of stocks that have broken out of a price channel. An extreme version of this is the all-time-high list. There are ways to keep this manageable, either subdivide by market cap and pick large, mid or small for the strategy, or apply a rank mechanism, either performance or 52w range or ??? Setting a stop on these breakout stocks tends to work. You should find that you don't swap the winners around too much (ideally the ranking method keeps long-term winners without getting in/out of them all the time).

Expand full comment

Do you usually share the code?

Expand full comment