Technical Indicators can be used for timing and weighting strategies. Using momentum as an example, you could go long if the momentum turns positive, or you could dimension the weight of your position depending on the level of momentum. Applied on a portfolio of assets, this would be called factor investing. This article will show you a way to weight your portfolio using factors.
Basic factor investing
Factors in factor investing can be technical (like momentum) or fundamental (like P/E ratio). The basic assumption in factor investing is, that stocks with high factor values will outperform stocks with lower factors. This basic assumption can be used in different ways. A lot of investors would only buy the stocks with the highest factor, as they would assume that high momentum stocks would outperform the average market. Or they could buy the top percentile and go short the bottom percentile to get a delta neutral portfolio. Usually an investor would try to out perform the index buy buying or selling a selection of stocks contained in this index.
Another way to do this would be to use a scoring card approach: the best stocks gets x points, the next one gets x-1 points… and in the end the points will determine the weighting of the specific stock in your portfolio. Both approaches are valid concepts and have been used for many years.
Z Score of factors
The approaches mentioned above unfortunately carry a lot of hidden parameters, which makes them sensitive to curve fitting. Which percentile of stocks will you buy, how will you weight them, how many points will you give to the best and to the other stocks, how many stocks should make it through this selection process….? These questions come even before the question on how you will weight your different factors…
A simple statistical trick can circumstance all these questions and directly lead to a sound portfolio weighting. This is done by z-scoring factors and thus converting them directly into the needed weights for the stocks in your portfolio.
The screenshot below shows how a z-scoring of factors is done with excel:
First you calculate the average over all stocks. Then calculate the standard deviation of your factors. To calculate the z-score of your factor just subtract the average from each factor and divide it by the standard deviation.
If you got more than one factor, do this for each factor individually.
On the screenshot above the top stock would get 2.56 times the capital (compared to original weighting in portfolio). The z-scored factor directly translates to the amount of capital invested. The sum over all weights is zero, thus it would be capital wise delta neutral portfolio.
Z-score portfolio weighting
The z-score is something really beautiful. It has a mean of zero and a standard deviation of one.
The mean of zero means that the z-scores factors directly lead to a delta neutral portfolio.
The standard deviation of one brings the outliers under control, and, as you will see with the long-only portfolio, also defines the number of stocks invested.
Z-score factor combinations
Usually a portfolio will depend on more than one factor. But keeping in mind that the mean of the z-scores is zero, it is easy to sum up and weight different factors.
If you got more than one factor, just do the z-normalisation for each factor individually, and then sum it up to end up with the final factor score. If you give a different weight to each factor it does not matter, the mean of the sum of all factors will still be 0.
Total Factor = Weight(1)*factor(1) +weight(2)*factor(2)+…weight(n)*factor(n)
Long only factor portfolio
A delta neutral portfolio can be easily archived by just using the z-scores directly as portfolio weights. To construct a long only portfolio you will have to do some further calculations.
In a long only portfolio each stock would get its initial (cash equal) capital + factor*initial capital. So if the equal invested stock would get 1000$ and the factor would be 1, this specific stock would invest 2000$.
On the screenshot above I have got 30 stocks, so each stock would get 3.33% of the total portfolio value. To exclude short positions, I reset all factors below -3.33% to -3.33. According to the weighting formula above, these stocks would get no money to invest. Only stocks with a factor above -3.33% would be invested.
The example above has 12 out of 30 stocks invested. As the long-only condition destroyed the mean=0 property of the z-score, you will have to scale down the long positions to end up with a 100% investment grade. To do so just sum up the weights of all long positions and divide the weights by this number. In the end the sum of all positions has to be 1.
Backtests of a z-score model
For a sample backtest of a factor weighted portfolio I took the 11 biggest automobile producers. See the screenshot below. It shows the returns of a cash equal weighted portfolio which has 100.000$ invested at all time and does not re-allocate the P/L.
The next chart shows a z-score weighted portfolio. The only factor used is the % change of the stock over the last 12 months. At the end of each month the portfolio is re-weighted.
The z-score weighting automatically puts the money in the stocks with the highest momentum. The histogram under the portfolio equity shows the number of stocks invested. Usually around half of the stocks are invested. For most of the time in history the z-weighted portfolio had about the same performance as the neutral weighted portfolio, but in 2020 the momentum weighting pushed more money into TESLA, which lead to nice outperformance. Also keep in mind that you only had to trade 5 stocks on average, and not all 11 automobile stocks of this basket.
Tradesignal implementation of z-score portfolio
At the end of the article there is the source code of this portfolio. It can be used in Tradesignal
The given implementation of the z-scores weighting contains three different factors. Factor A is the standard deviation, factor B is the distance from the upper Bollinger band, and factor C is the rate of change (%momentum). Feel free to change the code to test your own factors. Each of the factors can be weighted. Give it a positive weighting if you believe that a high factor is a good thing to have, otherwise give it a negative rating if you think that a low factor is advantageous. A weighting of zero removes the factor.
The factors on the screenshot below have been optimised for the highest risk/reward ratio. The data before 2015 is in-sample data, the data 2015-now is out of sample data.
Tradesignal Equilla Source code of multi factor portfolio strategy.
Safe the strategy and the function, compile and drag&drop it on a portfolio. Set pyramiding to “yes, all” and max entries to a high number. You can use the optimizer to find the right factor weightings.
This is stuff for experienced users. If you need help, leave a comment. Use at own risk
More on factor investing and how to simulate portfolio strategies in Tradesignal in my next webinar: Free webinar on factor investing