The Unhedged team has written and maintained many algorithms for many years and now you can enjoy the power of AI, machine learning and algorithms in your investing. Most of our algorithms are based on academic research to which we have applied our flavour and experience. However, the key is to create a combination of algorithms: we design algorithms that show a relatively low correlation to each other. That means when you combine them in a meaningful way, the result will be less volatile than when you would use only one strategy.

Sector Rotation Algorithm

Every industry has its heroes unbeknown to most people. Marcos Lopez de Prado is one such hero and was voted Quant of the Year several times and brought algorithmic investing to a whole new level. It would not be surprising if he received a Nobel Prize for his work.

This algorithm is based on Marcos’ Research, and it’s a tried and tested algo, but our quants have adjusted it to make it more robust by adding a trend detector.


Every stock or asset has its inherent risk based on the volatility it shows in the price. Volatile stocks (GameStonk, anyone?) have more risk, and not-so volatile stocks have a lower risk. The idea is that you give stock with a higher risk a lower weighting and stock with a lower risk a higher weighting. Altogether, it will result in a portfolio in which every stock has the same risk. At least, that is what a lot of traders thought.

Marcos found that this was flawed and later discovered that one should create clusters of stock that behave the same (ie. correlated). So he endeavoured to test this theory and create clusters of similar stocks. If you weigh those clusters, then there is a more reliable risk reward scenario.

Based On These Academic Research Papers:
  1. Lopez de Prado, Marcos. 2016. “Building Diversified Portfolios That Outperform Out-of-Sample.” SSRN Electronic Journal.
  2. Thomas Raffinot, 2018, The Hierarchical Equal Risk Contribution Portfolio
  3. Joseph Simonian, Chenwei Wu, Daniel Itano and Vyshaal Narayanam, 2019,A Machine Learning  Approach to Risk Factors: A Case Study Using the Fama–French–Carhart Model

Inner Workings

  • Determine the trend of the market.
  • Are we in an uptrend? We buy ETFs of the sectors of the S&P
  • Or in a downtrend? then we buy set of short and long duration bonds (IEF, TLH, TLT)
  • Weighting is based on the HRP Machine Learning portfolio allocation algorithm that determines the distance of ordered tree clusters based on the correlation and covariance of the returns. The stocks are weighted in such a way that the clusters have an equal contribution to the risk.

The Details

Because this algorithm is on the edge of Machine Learning and Artificial intelligence, it’s hard to publish gory details as from here on: it’s all code! What is interesting though is diving into which  ETFs this algorithm can buy.

This algorithm will be buying most of the time a combination of the following ETFs

  • XLB – The Materials Select Sector SPDR Fund: S&P 500 companies involved in any part of the metals, mining, or forestry industries
  • XLE – The Energy Select Sector SPDR Fund:  Fuel producers, refiners and transport.
  • XLF – The Financial Select Sector SPDR Fund: Banks, REITs, and financial institutions.
  • XLI – The Industrial Select Sector SPDR: Industrial companies like aerospace and defence, machinery, or roads and railways.
  • XLK – The Technology Select SPDR Fund: All kinds of tech companies, software and service giants, cloud and semiconductor.
  • XLP – The Consumer Staples Select Sector SPDR Fund: Consumer Staples: groceries, hygiene products, and tobacco
  • XLRE – The Real Estate Select Sector SPDR Fund: Focuses on investments in properties and property management.
  • XLU – The Utilities Select Sector SPDR Fund: The utility companies: electric companies, gas companies, and energy traders.
  • XLV – The Health Care Select Sector SPDR Fund: Biotech, pharmaceutical, and health service companies.
  • XLY – The Consumer Discretionary Select Sector SPDR Fund: Consumer discretionary luxuries, including restaurants, hotels, and cars.
  • XME – SPDR S&P Metals and Mining ETF: Companies that deal with metals and consumable fuels.
  • EWJ  – Tracks a market-cap-weighted index that covers roughly 85% of the investable universe of securities traded in Japan
  • EEM –  Tracks the investment results of an index composed of large- and mid-capitalization emerging market equities

Momentum  Algorithm

The momentum algorithm is a very well known and a well-researched algorithm. It basically says that stocks which go up for a bit have a high chance to continue, and stocks that go down for a while will continue to do so. But momentum is not enough to get a proper return. We only want momentum in quality stocks. So we filter on this as part of our automated analysis.

Independent on what a certain stock does, we also have to look at the wider market, so we look at the uptrend’s dispersion with an index and sector. Some sectors might be out of favour, and some markets might be on a glide path down. Let’s not buy those!

This algorithm always finds the gems, so if tech companies are driving the market, we surf the wave; if primary production companies are killing it, we invest in those: this algorithm aims to be very dynamic.


The hypothesis of this algorithm is that movement is followed by more movement in the same direction. It’s as simple as that.

Stocks tend to maintain recent price trends in the future, and the momentum strategy uses this. It’s silly but loads of people say this should not be a positive factor… yet, it is the most robust factor we have found

Inner Workings

  • Every day we scan 8,000 stocks and select the best on fundamental factors.
  • We find the companies that profit from their core operations (we use a proprietary metric that takes the capital structure into account). They must have healthy balance sheets (not too much debt, enough cash to cover their R&D and dividend payments) and have shown that their metrics are improving over time.
  • Once we find them, we wait until Big Money discovers these fantastic companies, and we ride the uptrend.

The Details

  • Momentum indicator: Modified Momentum is  the momentum based on the AverageTrueRange that expresses not only the momentum but also the velocity of the momentum
  • Quality: Take the highest “Modified Dupont ROE” (net margin*asset_turnover*equity multiplier). The Modified Dupont ROE is a proprietary indicator that determines the Health of stocks based on their Return On Equity, taking into account the company’s capital structure.
  • Weighting is based on the Smooth Momentum factor and the Drawdown Risk.
    • The smoother the momentum, the higher the weighting. Smooth momentum is defined as the number of up days
    • The higher the Drawdown Risk, the lower the weight.
  • Universe: stocks
    • that have over the 30 day Average a daily dollar volume of USD 10m+
    • Stock is not classified as in the Finance Insurance And Real Estate industry
    • The company must have a Market capitalisation of at least $500M USD

Industrial Activity Algorithm

Most products in your house will have Copper in them. Copper is really used in everything from electronics to water pipes, engines and the screen you are reading this on. It is a ubiquitously helpful thing. Another metal used a lot by the human race is Gold. We use Gold in jewelry, watches and things like space solar panels. It is also a most useful commodity to store value. Although storing value is important in society, Copper feels a lot more useful!


When there is growing economic activity the demand for copper increases, as a general rule. If it increases faster than supply, the price will rise. On the other hand, Gold is generally considered a defensive commodity as its value typically increases in times of economic uncertainty.
This Algorithm uses this relationship among other smart indicators to determine whether to be in or out of the market.
The Industrial Activity strategy is based on the correlation between metals prices and economic activity and the stress factors in the market. This indicator has a high correlation with US 10 Year Bond yields, and this correlation is used as a control to predict future mean reversions.

Inner Workings

The strategy uses the medium-term ratio between copper and gold prices and the velocity of the movement. As the Gold/Copper ratio is a slow-moving indicator, we added a generally fast indicator to react to internal stress in the US markets: volatility. The volatility complex has several known indicators, like the VIX* and Historical Volatility (HVOL) and, of course, the Volatility Futures (VX) prices. By looking at whether volatility in the future is relative cheap to current values or the other way around, we can determine what market participants expect to happen. We often see the volatility complex move before the Equity market itself moves. We use the relative movement in this volatility complex to determine whether we should decrease or increase Equity exposure.

The Details

This algo invests exclusively in ETFs representing the US Equity market, the Bond market, The Gold market or Cash.
  • QQQ
  • TQQQ
  • GLD
  • TLT (or related bond instruments)
The ratio is determined by the indicators discussed earlier.
* The Chicago Board Options Exchange (CBOE) Volatility Index (VIX) is an important index in the world of trading and investment because it provides a quantifiable measure of market risk and investors’ sentiments.(Source: Investopedia)

Based On These Academic Research Papers: Lopez de Prado, Marcos. 2016. “Building Diversified Portfolios That Outperform Out-of-Sample.” SSRN Electronic Journal. Thomas Raffinot, 2018, The Hierarchical Equal Risk Contribution Portfolio. Joseph Simonian, Chenwei Wu, Daniel Itano and Vyshaal Narayanam, 2019,A Machine Learning Approach to Risk Factors: A Case Study Using the Fama–French–Carhart Model.

Any financial products described on this page will be issued by third parties, as disclosed in the relevant disclosure document. All information is general information only and does not take into account your personal circumstances, financial situation or needs. Before making a financial decision, you should read the relevant disclosure document and consider whether the product is right for you and whether you should obtain advice from a professional financial adviser. Any information contained on this page may have been automatically generated by an algorithm based on raw data inputs, has not been independently verified and is subject to change.