In recent discussions I have examined the Kelly Criterion and Meta-labeling as means of risk management and now I am focusing on regime-based models. Regime-based models are trading models that are supposed to perform well in specific market conditions. The idea is that a combination of multiple, regime-specific strategies can outperform a single, all-weather trading strategy. However, in my opinion this is a misguided notion: managing multiple regime-specific strategies is just as challenging, if not more so, as having a single, more robust trading strategy.
Conceptual comparison of end to end vs regime-based strategies
The main issues with regime-specific strategies are:
- Changing market dynamics: Financial markets are constantly changing, with new information and events affecting prices and volatility. Time-specific strategies that worked well in past market regimes may not be effective in the future or may perform poorly during unforeseen regime shifts.
- Difficulty in detecting regime shifts: It can be challenging to identify, or even forecast, regime shifts accurately in real-time, leading to poor performance and increased risk. Even if you have N perfect regime-specific trading strategies, knowing when to switch between them is the real challenge, which is somewhat related to the meta-labeling problem. You basically need a meta-strategy "wiser" than the main strategy currently in use to determine when to switch.
- "Regimes" are mental constructs: The concept of regimes is simply a way of explaining why different rules apply in the current market and they may not be clear-cut. Conditions can change rapidly (e.g., during the Covid pandemic) or slowly (e.g., during the 2010-2020 bull run), resulting in a mix of past regimes or new, unseen ones.
In my opinion, regime-based trading is a form of overfitting. You have a strategy that works well under specific conditions and hope to figure out the best time to apply it in the future, which is basically market timing.
Instead of developing multiple, market-specific strategies, I prefer to focus on developing machine learning (ML) models that account for overall market conditions (e.g., VIX, yield curve, etc.) and embed them in the training and targets of my model. I prefer simple and agile models that can be retrained quickly (e.g., weekly or even daily) to incorporate market changes immediately.
I argue that traders should adopt a more flexible, adaptable approach that adjusts to changing market conditions in real-time. This could involve using ML algorithms that learn from data and adapt to changing conditions, or using a combination of fundamental and technical analysis to make trading decisions.
I have included a toy ML-based algorithm that incorporates the VIX value as a regime feature as a starting point for further development. Note that I would have preferred comparing a regime-based and an end-to-end strategy, but I did not have the opportunity to develop one. If the topic is of interest, I can look into comparing a simple In-and-Out classic strategy with an equivalent ML-based version.
Jared Broad
Funds with consistent performance like Rentech and WorldQuant deploy millions of factors which could be considered as “regime specific”; swapping out the factor weights on their relative profitability as the markets change. There are whole teams of people at those funds dedicated to how and why to swap the factors in and out – I agree its difficult. Just IMHO I wouldn't discount regime specific algos/factors.
The most common danger I see in making a single strategy for all time is overfitting. ML can mitigate this by making the strategy more dynamic to changing market conditions – but more likely ends up hiding the overfitting.
For the Alpha Streams portfolio construction we explored various ways to combine the strategies for months unsuccessfully; eventually concluding the underlying strategies were in aggregate worse performing than the index so it made beating the index very difficult. It was easy to fall into look-ahead bias by selecting strategies with knowledge of their future performance; and building a rolling alpha selector resulted in, sadly, poor performance.
Interesting discussion though! There's no clear cut answer! =) I'm sure some of Citadel's stat arb strategies perform well no matter the market conditions.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Francesco Baldisserri
Hi Jared, thanks for your comment!
Indeed this discussion could go on indefinitely with supporting arguments for either side. I am sure there are succesful regime-based traders; my opinion is that, in regime-trading, the In/Out part is the most difficult one and also the In/Out logic itself needs to change over time in order to stay profitable (kind of a meta-In/Out!).
With this assumption I (personally) prefer focusing on an end-to-end algorithm that learns from the latest market data while trying not to overfit as I feel less confident about my ability to know exactly when to use or not my set of regime-specific factors.
Indeed no clear cut answer! :-)
Lars Klawitter
hi Francesco,
many thanks for another insightful post! It prompted me to finally get on with trying out regime metrics for my algorithm. Something I had had on my list for a while.
The algorithm is using ExtraTreesClassifier to trade on a universe of large cap US equities. It is a modified version of Cole S' code that he had published here. Amongst other things I added Kelly sizing (also something one of your previous posts inspired me to add).In its current form the algo does reasonably well, consistently beating SPY, but with the occasional ~20% drawdown. Adding tighter risk management only ever made the risk adjusted performance worse, so for a while I had been contemplating adding a form of market regime signal to adjust the trading logic.
This is what I tried out:
I had high hopes in Hidden Markov Models and particularly in the concept of switching between risk-on and risk-off universes.Long story short - Neither (nor any combination of the two) performed in any meaningful way. The HMMs don't seem to produce any reliable signal for bear markets and the switching of universes never reacted quickly enough to make a positive impact in terms of reducing risk. It merely curtailed the overall performance.
As you pointed out in your post adding VIX as a feature (1.2 / 2.2) didn't improve the risk adjusted return.
So in summary, the only marginal improvement I could see was through (1.3.2 / 2.1.2), i.e. a dynamic adjustment of the total exposure base on a signal essentially interpreting vol of vol (reducing exposure when VIX is above its MA).Backtesting over a 10 year timeframe produced more or less the same Sharpe ratio as the same algo without regime signals, BUT using the signal improved my out of sample test quite a bit!
Whilst I'm a bit miffed that all the clever concepts I had envisaged bombed badly, I think I'll keep the fairly conventional approach of VIX based bet sizing.
Francesco Baldisserri
Hi Lars,
Thanks for sharing the results of your experiments. Quite thorough!
Indeed also many of my high-level conceptual strategies have been destroyed when it came down to backtesting (or worse, forward testing) so now I try to "feed" all relevant features to the ML model and have it take into account risk, regimes, etc… It's not easy but I believe it's the most robust method when it comes to out of sample performance.
Keep me posted on your future experiments!
Francesco
Lars Klawitter
hi Francesco,
yes, I got that sense, reading your posts about meta labelling and regimes 😊. I have to say that giving the model all relevant information to begin with and let it come to the optimal conclusions makes a lot of sense and it is indeed a strong rebuttal of the approach of adding layers of logic and information that would have been better placed in the primary model.
Having said that, in this particular case adding the VIX as a feature did not test well at all, so I think I'll go with the approach of flexing the portfolio exposure up and down based on vol of vol, which does make conceptual sense to me.
Take care
Lars
Eden Wheeler
Hi,
While regime-based strategies have gained popularity in recent years, there are several concerns about their effectiveness in the long run. As mentioned, the main issues are the changing market dynamics, difficulty in detecting regime shifts, and the fact that regimes are mental constructs that may not be clear-cut.
On the other hand, end-to-end strategies that incorporate overall market conditions and adapt to changing market dynamics in real-time can be more effective. These strategies typically use machine learning algorithms that learn from data and can adapt quickly to changing market conditions. This approach allows traders to adjust their strategies as needed and stay ahead of the curve, which is especially important in fast-moving markets.
Furthermore, end-to-end strategies can be more agile and easier to manage than multiple regime-specific strategies. Rather than trying to manage multiple strategies, traders can focus on a single, robust model that can adjust to changing market conditions.
In conclusion, while regime-based strategies have their benefits, they may not be the most effective approach in the long run. Instead, traders should focus on developing end-to-end strategies that incorporate overall market conditions and adapt to changing market dynamics in real-time. This approach can be more effective, agile, and easier to manage, ultimately leading to better trading performance.
Santa24
Are there some insights or recommendations from the QC Staff or professional traders with track record?
It seems that building one strategy (be ML or rules based) to perform well in all market regimes is not what the pros with track record are doing. Instead they build multiple very simple highly uncorrelated strategies and ensemble them in a smart way and have sophisticated ways to test a strategy robustness. The example i have seen of a long year profitable fund (sharpe > 2) does something liek this:
To develop this, you would need 4 teams or 4 experts with domain expertise in every of these approaches. No idea how to do this or find those people. Would great if QC would offer a way to connect team members so those ensembles could be built….
Francesco Baldisserri
Hi Santa24,
The approach you mention is interesting. Indeed, when you mention “…ensemble them in a smart way and have sophisticated ways to test a strategy robustness…” it makes me think that this is the really difficult part.
How do you know when to switch between S1, S2, S3 and S4? Or they are always on with a static capital share? In the former case you need to predict regimes and in the latter the combination of these strategies is a regime-less strategy.
As much as I'd like to have 4 experts or teams for specific areas I feel the biggest question is still “When will strategy X fail?”
Regarding Spitznagel in particular my understading is that Universa has a pretty stable portfolio (i.e. they don't try to time the market or regimes) which loses most of the years but has huge profits during crashes that occur every 5-10 years, leading to an overall positive performance.
Santa24
Francesco Baldisserri : I do not think there is much switching happening, ,and regime prediction is probably more difficult than point estimates and no one is doing that in practice. As a fund you always have all strategies running (naive equal weight) i guess or a sophistcated bet sizing of the sub-strategies. Spitznagl approach is just a permanent tail risk hedge that is alwayas “on”. You can be a great ML or data engineer, but without the finance domain knowledge you will always fail. From discussions I had with people from Citadel and other sucessful profitable funds is that the profitable strategies running are mostly rule-based and are not really using any ML. For the rules they use specific domain knowledge or have access to datasets that no one has to allow arbitrage. So if you manage to generate the 4 different strategy types with simeple rules (3-5 params) each and run the ensemble you will make money. ideally I hoped that QC would provide a community forum to match up sub-strategies. Say if I generate a very good s1-long-only-stock selection, I would like the QC forum to match me with others who have good s2 or s3 thereby generating a better strategy ensemble. It cannot be expected, that the pros who know what they are doing, whill share their approach or rules in any forums :)
Peter Guenther
Great post, Francesco Baldisserri and interesting discussion. Based on running the In/Out strategy for some time now, I fully agree that it's difficult to capture the market's dynamics accurately based on (arguably relatively simple) rules. I had to consider the general news (eg regarding inflation) plus chart analysis to make this work in a meaningful way. If I wanted to integrate these logics into the algo, this would be very difficult. Maybe ML could capture this, but I reckon it will be difficult as well. I will definitely check it out. Thanks again for sharing and keep up the great work 👍
Francesco Baldisserri
Thanks Peter Guenther, I agree with you that identifying regimes is very difficult, both manually and via ML. What I don't like is the approach “my strategy X works, the problem is that it's not the right regime” as this is swiping the real issue below the carpet.
Good luck with your In/Out strategy, I'd suggest trying using ML for the In/Out logic, at least as a comparison, by plugging also the inflation data!
Keep me posted,
Francesco
Carsten
Lars Klawitter regarding your HMM, you might have a look at the following paper (ups, how can I show only the link?) Anyway… the trick was not to use the VIX, but to use the futures directly. Just divide first future by second future and plug it into the HMM (I used the standard one HMMlearn, the author uses matlab)
As a second label he uses volatility, which I think is not so helpful as high volatility does not yield low returns in any case.
On can get the historical volatility futures free of charge from the Cboe, it was a bit complicated to generate the first and second future as a timeserie, but I found some examples in the internet.
I just built everything as a python notebook.
Bottom line, using futures was a big difference compared to VIX. The In/out worked extremely well for events were the VIX spikes, like 2018/2019 and COVID 19, but performed very poor during periods like 2015—2016.
To optimise, I would look to either optimise the train window (I used 2 years and if the are no big VIX events the HMM interprets noise as signals and gets in and out), second to use a different ML technique instead of HMM as HMM is said to produce errors at the start and end of the time series and probably use additional labels which for example could detect the 2015/2016 market behaviour better.
Just my experience …..
Lars Klawitter
hi @carsten_1
Many thanks! That makes sense. I'll have another go at HMMs then!
Will report back on the results
Carsten
Lars Klawitter if it helps I could send you the notebook. I would like too improve the algo as well and actually looking for a replacement for the HMM, but not sure which other ML to use as a substitute.
Lars Klawitter
Carsten , that would be great! many thanks in advance. Can I find you on Discord?
Carsten
and forgot to mention, every time you run HMMlearn it might switch the order of the states it puts out. You need to check for that, but you probably already know…
Carsten
Lars Klawitter should be this one carstenf#5495
Anastasios Bikos
Great Post, Francesco Baldisserri, 😀
It has always been the Αpple of Discord to be mathematically capable of deterministically predicting the next stock market asset tick price through a polynomial time completeness Turing Machine.
For nearly 5 decades, hundreds of technical indicators, endless strategies, and quite recently (even Quantum) Artificial Intelligence have been deployed for this mathematically heroic (trivial) accomplishment.
I endorse your arguments. Let me collate also that we need to formulate the nucleus core of the problem to solve. Moving the Stock Markets is to allocate its true Dynamics, which is… Chaos. Thus, my scientific opinion is that the potential success of such a Turing Machine dedicated to predicting, or reverse-engineer the stock market prediction, should rely on Fractal Dynamics.
The Mandelbrot SetI am currently architecting some conceptual attempts for this purpose. Once I have some active backtests and analysis I will gladly notify the QuantConnect community.
In the meantime, please kindly refer to these academic research publications:
[1] Arashi, M., Rounaghi, M.M. Analysis of market efficiency and fractal feature of NASDAQ stock exchange: Time series modeling and forecasting of stock index using ARMA-GARCH model. Futur Bus J 8, 14 (2022). https://doi.org/10.1186/s43093-022-00125-9
[2]
Keep up the good work!!
Francesco Baldisserri
Hi Anastasios Bikos , I'm glad you liked the article and thanks for the article you shared. I'm looking forward to knowing more about your research!
Francesco Baldisserri
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!