Ensemble Strategies [Reduce Overfitting By Combining Strategies]
What is an Ensemble Strategy or Method?
“In statistics and machine learning, ensemble methods use multiple learning algorithms (trading strategies in our case) to obtain better predictive performance than could be obtained from any of the constituent (individual strategies) learning algorithms.”
A simpler example would be to think of it as a voting system. Imagine 3 SPY strategies. In theory (and every individual case needs tested), if one strategy says long and the other two say flat (or short) then long is not a very confident position. On the other hand, if two or all three strategies say long then it is a more confident entry.
It is also important to point out or imagine the market as a living breathing organism that is constantly evolving and dynamic in nature. So imagine having a strategy on Oil, Gold, Bonds and Stocks. Now you can get a better picture of what is happening in individual markets and how their combination or interaction can help predict what to do next in a stock index strategy or the US dollar strategy, for example.
This is slightly different than intermarket strategies because intermarket strategies simply include ‘signals’ form secondary markets. Ensemble strategies are actually using the strategies themselves which undoubtedly carries more information than just the signals themselves.
Ensemble Strategies in the real-world and Finance
The first example, is about the Netflix challenge where Netflix offered a million dollar prize for the “best suggested movies to watch” algorithm. Jaffray Woodriff, founder and CEO of Quantitative Investment Management ($3B in AUM), competed in the contest and took 3rd! Woodriff is a big proponent of ensemble methods and mentions such in his Hedge Fund Market Wizards chapter of Jack Schwager’s great book. The team that actually won the contest was in a close race with the second place team and wound up running away with the first place prize by using an ensemble method applied to the other top 30 competitors’ models. I am trying to convey financially incentivized practicality here; this story and example comes from Ensemble Methods in Data Mining by Giovanni Seni and John Elder with a foreword by Jaffray Woodriff. Woodriff, and many other successful hedge funds, utilize ensemble methods in their approach.
Ensemble Strategies and Trading
The two main things that plague trading strategies are
1. Underfitting (bias)
2. Overfitting (variance)
In the latest book sweeping the Quant world: Advances in Financial Machine Learning, Ensemble Methods have their own dedicated chapter! In this chapter, the author Marcos Lopez de Prado (head of AQR’s machine learning division and formerly founded and led Guggenheim’s Quantitative Investment Strategies that had over $13B in assets) states, “An ensemble method is a method that combines a set of [weak] learners… in order to create a [stronger] learner that performs better than any of the individual ones. Ensemble methods help reduce bias AND/OR variance”.
So ensemble methods can help reduce overfitting? That sounds desirable for every system trader I know!
Quick tips to keep in mind:
-Ensemble strategies can be done on similar strategies such as the same RSI signal on multiple markets or ensemble strategies can be done on diverse individual strategies. For example, use one volume strategy, one price action strategy, one trend strategy, one seasonal strategy, one mean reversion strategy and then ensemble.
-Do not try and ensemble very poor individual strategies and expect miracle improvements. Simple ensemble methods such as bagging (averaging), cannot improve the accuracy of such poor systems. So you still have to put effort in designing the individual strategies! Ensembling is not a shortcut that can turn dirt into gold; however, it can polish up some gold very nicely.
-Finally, ensembling (with bagging) is more likely to be successful in reducing variance (overfitting) than reducing bias (underfitting). This attacks the BIGGEST problem we typically face as system traders and developers.
So How is Ensembling Done with Build Alpha?
We can now select individual strategies that we want to use in the overall simulation. This means we can build strategies that only take a position when another strategy has an existing position. This is a great way to create hedging strategies (more on this in a later post). Below are a possible few examples..
Go long when X,Y,Z signals are true AND strategy23 must be long.
Go long when X,Y,Z signals are true AND strategy47 must be short.
Go long when X,Y,Z signals are true AND strategy23 must be long and strategy 47 must be short.
*note this would build strategies that would use SPY Trend Strategy’s market position as input*
Secondly, we can select ‘Ensemble’ signals such that we get an entry signal when at least N strategies have a position. Then the user can select which strategies are ‘active’ to be included from the portfolio window (detailed example below). If I have 3 strategies created named strategy1, strategy2 and strategy3 and select the “Ensemble at least 2” signal then Build Alpha can create a strategy like this:
Go long when any 2 of the selected strategies have a position. So your first trade in your ensemble strategy might happen when strategy1 and strategy2 have a position. The second trade of your ensemble system may enter when strategy1 and strategy3 have a position!
*note this would build strategies that would be able to take a position when ANY two strategies above have an active market position*
How Can I Make Ensemble Strategies Only Using The SPY Strategies?
1. Only mark the SPY strategies as active in Portfolio Mode.
2. Select Ensemble Signals (at least 2 and/or at least 3)
How Can I Make Ensemble Strategies Only Using The Non-SPY Strategies?
1.Only mark the non-SPY strategies as active in Portfolio Mode.
2. Select Ensemble Signals (at least 2 and/or at least 3)
How Can I Make Ensemble Strategies Using All The Strategies From My Portfolio?
Of course we can remove the ‘guess work’ and select all the strategies as active and allow Build Alpha to find the best ensemble strategy for us. The flexibility always remains: ability to do very specific manual testing -OR- select all and allow the machine to find the best ensemble strategy. This theme is constant throughout Build Alpha’s design and not specific to ensemble learning.
1.Mark all strategies in Portfolio Mode as active.
2. Select desired Ensemble Signals
*note the green highlight box in the right photo. This shows that I have 1004 entry signals selected and 1000 exit signals selected. We can see the 4 Ensemble Signals selected and the other 1000 entry signals are from the main signal library of over 5000+ signals that include price action, candlesticks, volume, technical indicators, etc.*
**To Traverse between portfolio/ensemble signals and the main signal library make a selection from the ‘filters’ drop down menu above**
Ensemble strategies also have another benefit of allowing traders to use less capital to trade off of information presented by multiple strategies. For example, a trader may create multiple strategies for market XYZ all based on various, different and uncorrelated factors; however, he/she may not have enough capital to allocate to all of the strategies. On the other hand, a trader might find a strategy that is useful on many different markets but not possess the capital required to trade more than one market.
Ensembling the original strategies can allow for more efficient allocation while still maintaining the information extracted from each one of the individual strategies (better or more information at least than any one of the single strategies).
Ensembles: A Case Study
The simplest example I can present is the RSI2 strategy presented many years ago in Larry Connors and Cesar Alvarez’s book, Short-Term Trading Strategies That Work. I have applied the simple strategy on four ETFs: SPY, DIA, QQQ and IWM. My goal is to find an ensemble strategy to trade SPY based off the individual RSI2 strategies applied to these four markets. I ran the test from 2000 – 2018 using fixed sizing method.
Below you can see how using ensemble methods to trade these four strategies just on SPY can make improvements in a few different ways.