No Risk, No Fun
Testing concentration and risk mitigation rules in a long-only global ML strategy.
In this post, I will test if limiting concentration in sector, industry, country or cap count, position size control or correlation checks can improve risk statistics of my global ML strategy. If you already use Portfolio123, you can use these rules to replicate these tests for your own strategy (if your sell rules are simple enough).
Full Disclosure: This article is sponsored by Portfolio123. The platform provides high-quality industry-standard data and powerful no-code stock analysis tools to boost your investment process. The growing community of skilled and creative traders and investors shares their knowledge publicly and enables quick success. Nowadays, I do most of my research and all of my single stock analysis using Portfolio123.
If you want to support my work and want to check out the platform, sign up today and start your free trial using my affiliate link.
Basic Premise
For this exercise, I will use my current 10-stock global multifactor (+ML) microcap strategy. I described most of the step-by-step construction of this strategy (and other regional strategies) in my “Layers of Return” series.
It only uses one single sell rule “RankPos > 100”, meaning that the strategy sells a position only if it drops out of the Top100 of stocks in the universe ranked by the underlying Multifactor+ML ranking system.
The ML algo is trained on a prefiltered universe limited to sectors, countries, and liquidity buckets, I really want to trade. The classic multi-factor ranking delivers a cost-aware, evidence-based and robust base to moderate turnover and avoid the worst junk picks. As a consequence, the combined ranking system does a great job in sorting stocks according to their expected 1- to 3-month forward returns.
That also means that I try to avoid messing with the ranking by using complex buy or sell rules. However, there are use cases for additional rules, even in well-rounded strategies with all necessary liquidity, sector and exchange filters already present in the universe rules. In my opinion, most of these use cases revolve around issues that the ML can not learn or consider easily:
Trade frictions (e.g. Rank or RankPos sell rules for rank tolerance)
Up-to-dateness (e.g. discounting outdated data by using WeeksToQ or WeeksIntoQ)
Timing/Hedging (e.g. increasing cash position based on trend signals)
Portfolio composition control (e.g. limiting sector count or max. position correlation)
Today, I will focus on the portfolio composition aspect. Both ML predictors and linear ranking systems rank stocks cross-sectionally on an individual basis. In the final ranking, there is no focus on quantile bucket composition, meaning a stock’s rank is not corrected for the number of similar stocks in the same rank bucket. Conversely, industry momentum and macro trends can lead to pronounced industry concentration and country concentration in the top and bottom rank quantiles.
Generally, overconcentration in certain themes or sectors is considered an unwanted risk most investors are not willing to take. So let’s see how controlling those exposures affects risk and return in my strategy.
Class Count Rules
For the purpose of limiting the count or weight of certain stock classes such as industry, subsector, sector, country or size bucket, Portfolio123 has a set of standard formulas available:
So I simply tested all of the “Count” versions and noted the return, max drawdown, Sharpe ratio, Sortino ratio and S&P500 Beta:
As you can see from all “<=1” rule statistics, being too strict about country or industry diversification does more harm than good. Prudent CountryCount limitation can give some benefit in a concentrated global strategy, which makes intuitive sense as country momentum is a much weaker effect than industry momentum and thus the increased currency risks, political risks and other macro risks are likely not paid.
I added the “CapCount” rule for completeness, however, it makes little sense here since I restrict my universe to small and microcaps anyway, which limits the possible Portfolio123 size classes in the portfolio. The rule might be useful for all-cap strategies though.
The outlier in the test clearly was “SubSecCount <= 3” but due to multiple testing bias and the lack of clear trends, I would not interpret too much into it.
I think, we can conclude for now that prudent country and sector weight restrictions can be added to increase your trust in the strategy without too much harm. However, overriding the long-only ranking with such rules still on average does more harm than good on paper, which is in agreement with academic research.
The most interesting observation in my opinion was that beta increased with restrictiveness. The more stocks you skip to enforce diversification, the closer the strategy moves toward the index.
Position Correlation
You could argue that classic industry and country classifications are flawed.
What country does a stock really belong to? Country of the main listing? Headquarter country? The country where most of the revenue is generated?
The same goes for sectors and industries. Take the current AI trade. There are many semiconductor, datacenter REIT, communication, construction and other stocks which are trading in sync right now following the same macro theme while other peers from the same industry classes lag behind. Some classifications will just be wrong, outdated or changed frquently.
So maybe it is a better idea to check for return correlation. For this I use the MaxCorrel(n, s) function, which checks the max correlation between buy candidates and current portfolio holdings over the past n trading days using s-day return samples.
The following table only shows rules using 0.3, 0.5 and 0.7 thresholds and s=1 settings. I also tested weekly samples (s=5) but without much difference in results. Smaller or larger threshold values were too restrictive or not restrictive enough:
Most settings had an adverse effect or no effect at all, which makes it hard to thread the needle and increase overfitting risk. We observe again rising betas and but also increasing drawdowns, especially for restrictive short-term rules. It can be assumed that the rules mess with momentum components and forces the strategy to diversify into low-momentum stocks or stocks with idiosyncratic technical behavior, which is most likely a bad sign in most cases.
Position Size
Position sizes getting out of balance is another typical concern. Letting winners run is a nice concept on paper but if a single position becomes 30% of your portfolio, it might become a risk. Also if you always want to be 100% invested, sometimes you need to give buy position sizes some room regarding deviation from the ideal size. The standard setting in Portfolio123 is a +/- 30% deviation:
To check when to trim, we use the Eval() function with a “Weight” condition in %, a target fraction (I will use 0.33) of the position to be sold if the condition is met and 0 to do nothing if the condition isn’t met:
The following table summarizes the results for the position size controls:
As you can see, trimming of extreme weights does not harm the performance notably. Staying closer to ideal sizing can even have positive effects. Once again it is hard to draw a definitive conclusion due to the lack of clear trends and multiple testing bias. However, if it makes you feel better, why not…
(Possible) Conclusions
It is hard to generalize the findings but in my humble opinion, for a well-rounded system including ML, restrictions usually do more harm than good. If your ML predictors are trained on a stable universe and a versatile robust feature set including momentum, quality, growth and value metrics both individual and industry-wide basis, it will do a good job finding the right entries and exits. In most cases, concentration in a certain sector or country will be intentional.
This makes constraints mainly a “sleep well” kill switch which can be useful in the future. For example if semiconductors truly become the “only game in town” and seduce the strategy into going all-in one theme, you might want to intervene. As long as you are not too restrictive that shouldn’t do too much harm.
Of course, the question also strongly depends on your total portfolio which might include more than one strategies. As you know, I trade 3 regional long strategies + 1 short strategy. Even if one of the long strategies becomes too concentrated, it won’t put the whole book in danger. Only a few people are truly trading a 5-10 stock strategy with 100%(+) of their capital.
Also other portfolio characteristics like turnover are crucial.
So when would I recommend exploring the investigated constraints and controls:
If you are highly concentrated (<10 stocks)
If you only trade one strategy
If you don’t use ML
If you trade low-turnover strategies (<200% annual)
If you are risk-averse and want to sleep well at night
Finally, let’s check how combining the best rules of the analysis affect the strategy. For that I use:
Buy: MaxCorrel(200,1) < 0.3
Buy: CountryCount <=5
Buy: SubSecCount <=3
Sell: Eval(Weight>20,0.33,0)
Buy Constraint +/-10% of ideal size
I have to admit that this is a nice improvement of the max drawdown and the Sharpe Ratio and shows that there is no adverse interactions between the rules and settings.
However, the boundary to overfitting is rather blurry. I will explore the concepts for all my strategies and see what’s the most replicable low-restriction configuration across strategies and decide if it’s worth implementing.
For now, the results are not clear enough for me to add complexity.
But maybe they might be for you. Just do your own due diligence!
If the presented tools and concepts resonate with you so far, feel free to join the Portfolio123 community through my affiliate link – it supports my work at no extra cost to you.
Disclaimer
This publication provides general information on systematic investing and Portfolio123 strategies for educational purposes only. It is not personalized financial, investment, tax, or legal advice. All content reflects my independent opinions and analysis. I may hold securities mentioned in posts. Past performance does not guarantee future results. Investing involves significant risks, including potential loss of principal.
No recommendations: Do not buy, sell, or hold any securities based on this content. Consult qualified professionals before making investment decisions.
Disclosures: This Substack is sponsored by Portfolio123. I am a Portfolio123 affiliate and may earn commissions from links at no extra cost to you.
Your use of this information is at your own risk.










Have you tried playing around with weights constraint with Dynamic Weight sizing method vs static. I had some interesting results there