Approach to optimization?

I have tried various strategies to optimize my ranking systems, but I am open to more tips on how you approach optimization?

I have searched a lot in the forum, but there is very little discussion on how each of us systematically builds the ranking system and then optimizes it.

MY METHOD

PREMISES FOR TESTING

  • Before I start on a strategy, I have a volume rule and test the strategy against the universe I am trading in. I always test it on at least 25 stocks or more, with variable slippage and hi-low 2x.

  • Volume: MedianDailyTot(120) >( 70* 1000) and price > 1

  • EU Universe: ExchCountry(“nor”) or ExchCountry(“swe”) or ExchCountry(“FIN”) or ExchCountry(“DNK”) OR ExchCountry(“DEU”) or ExchCountry(“nld”) or ExchCountry(“bel”) OR ExchCountry(“fra”) or ExchCountry(“ita”) or ExchCountry(“ESP”)

  • US and CANADA, volume rule and North America Primary

  • I prefer to have more nodes than too few. I am not sure if this is correct, but I think it makes the system more robust.

  • I distribute the nodes according to 7 factors folders (Sentiment, Momentum Size (Mkap, Volume) Quality Growth and Volatility).

  • I want the keep the turnover under 350%

  • I want to keep most of the strategy to the rankingsystem, and and only use this as a sellrule: Rank<98.4 and StaleStmt = 0

  • In most cases, my ranking systems have so many nodes that they are not weighted differently, but are evenly distributed. However, different factor maps are given different weights, which means that each node is give different weight accourding to he factor folder.

  • image

  • I start the strategy by over-optimizing it, and then subject it to robust testing: different portfolio sizes, different sub-universes, and different periods.

OPTIMIZATION METHODS I HAVE TRIED

  1. I have tried optimizing by combining different nodes (at least 25+) by looking at nodes in a multifactor system that are least correlated. It did not work well and required a lot of work: Measure - MATRIX AND CORRELATIONS BETWEEN LONG-ONLY FACTOR RETURNS - #5 by Whycliffes

  2. I have started the ranking system by adding one node at a time to the different factor folders. Run simulations for the entire period. It has not worked well.

  3. I have also started at the opposite end by using the simulation. For example, by combining the 5-10 best systems I find from public ranking systems (e.g., 180 nodes), and then setting one node to 0% at a time. Run simulations with at least 25 stocks against the relevant universe. If it gives better results, I keep it. I go through all of them, and make sure that there are at least 4-10 nodes left in each factor folders.

  4. I have also used rolling tests in the same way. Set one node to 0% and run a rolling test with a frequency of 4 weeks and a holding period of 3 months to see if it has produced better results. In this way I can reduce a large system to around 150 nodes.

  5. I have also run Danp and his API test of 1500 nodes on the universe, with 1-week rebalancing (full) 17 years backtest. I take out 10 of each factor (momentum, value growth, sentiment, quality, volatility, size) that has performed best for the last 15 years, or gets the best score (score: a mix of returns, stability in yield, rise in growth, and deductions for missing data, etc.): Explanation for List of factors.xlsx spreadsheet and the ranking of rank factors - #9 by danp. And rund the same test as above.

  6. The weight of the factor folders is done according to the same principle. I set the others to 0% and run a performance test, and then weight the factor maps based on their historical performance, and then normalize the folders. That gives me this on the US CAD universe:

  • 25%GROWTH
  • 9%MOMENTUM
  • 20%QUALITY
  • 16%SIZE
  • 4%VOLATILITY
  • 22%VALUE
  • 4%SENTIMENT

How do you perform the optimization ? I’m interested in all tips on how you do it and feedback on my method above.

Related to the subject there is a discussion here (alternatives to optimization?)

1 Like

This isn’t really about optimization per se…but one approach that I feel is underrated is to take your ranking system and run it 100% hedged against the market in advanced sim. Or long/short in the screener. Or both.

The idea is that you can get a great looking ranking system on the top 50 or 100 stocks in a universe long only. But then you neutralize it against the market and you can see very clearly periods of out-performance and underperformance. What I like to see is a nice upward sloping consistent equity curve when it is market neutral. What I don’t like to see is where out-performance rockets for 5 years or more than then goes flat…then negative. Over a 20 year backtest you still look great but it is only because the first 8 - 10 years were amazing and it wasn’t great since 2010.

Consistent alpha is at least as important if not more so than the amount of alpha it generates.

1 Like

Thank you Hemmerling. But don’t you think that you could achieve a similar effect as you describe by starting the ranking system (simulation) at different periods, so that such timing luck, reveals the weakness in the system? Otherwise, I completely agree that “Consistent alpha is at least as important if not more so than the amount of alpha it generates.”

My intention with the post was primarily to find out how different members go about optimizing their ranking system, as a brainstorming from my side, because I have hit a bit of a stop. I don’t know what else I can do to try other methods to optimize my factors, factor folders or nodes.

So, if anyone is optimizing in different ways or has any tips on how to do it better, I would be grateful for any input!

So this is one of my processes that helps.

Make hundreds of ranking systems, one factor per ranking system.
Make one ‘higher is better’ and one ‘lower is better’.
Create a simulation which longs the top 50 or 100 stocks in the universe.
Carefully pick your target universe. In this example I use a higher yielding stocks in TSX.
Run it with 100% hedged against an applicable index. Now it is market neutral.
Use the optimizer to run all your single ranks one at a time (still market neutral mode).
Look at the market neutral returns of each factor visually.

In this instance I see a couple things that need further investigation. My custom formula for free cash flow (using only maintenance capex instead of maintenance plus growth capex) has 7% annual outperformance over my benchmark. But mid-point the excess return goes wonky. It had a big run up and then drops for many years and then rises again. Compare this to the other custom FCF formula that divides FCF by marketcap (instead of EV). This doesn’t go through as steep a drawdown of excess returns over the past 10 - 15 years. I will try to investigate why that is. Maybe the EV formula is bringing up a bunch of NAs in the TSX or something else.

Now look at the 2 year Sharpe and gross profit to book value factors in this universe.

The excess return of these factors are a lot more consistent over time. A market neutralized portfolio when looking at individual factors can help you understand if the factor premium is volatile or stable. I prefer stable factor premiums as I don’t want it to turn on me for the next 10 years.

This is just one step when analyzing factors. What I don’t want is a factor that worked well from 99 to 2007 and quit. But the long-term backtest still looks amazing since early gains make it have high total return. But where it hasn’t worked well recently.

1 Like

I would like to follow up on this post.

I have tested optimization with the use of a simulator, rolling test, sub universes, different periods, Danp’s spreadsheet (which has probably taught me the most), I have also tried to follow the method described here: How to Implement a Stock Trading Strategy - Portfolio123 Blog works-part-three-principles-of-backtesting/ etc. It has taught me a lot.

But can someone explain how P123 has proceeded more concretely, (and preferably in detail) when you have weighted nodes and folders differently in these systems:


  • do P123 use the simulator, rolling test, performance in the ranking system
  • how do you proceed when considering the weighting of nodes and folders
  • which robustness tests do you subject the systems to
  • do p123 just adjust back and forth until the ranking system gives the optimal return, alpha, sortino, turnover?

PS: Very good there have been some new systems lately. Hope there will be more. :slight_smile: