Markets do not behave the same way throughout the year. There are periods when prices move within a relatively narrow range, periods of steady movement and periods when volatility increases significantly.
Rather than defining these conditions using fixed volatility thresholds, I wanted to see whether a statistical model could identify different market conditions from historical price behaviour.

I used a Gaussian Mixture Model (GMM) in Python with two inputs: annualised volatility over the previous 20 trading days and the percentage return over the same period. A Gaussian Mixture Model is an unsupervised learning method that groups observations based on their statistical characteristics.
For this experiment, I generated synthetic Nifty-like index data from January 2006 to October 2026. I trained the model on the first half of the dataset and used the second half to evaluate the results.
The model was configured to identify three groups, which I labelled calm, normal and stress based on their volatility characteristics in the training data.
Looking at the testing period, calm conditions accounted for approximately 60% of the days, normal conditions for 23% and stress conditions for 16%. The annualised volatility of subsequent daily returns was approximately 11%, 17% and 30%, respectively.
I then tested a simple portfolio rule. The portfolio remained invested during calm and normal conditions and moved to cash when the model identified a stress regime. I included a transaction cost of 0.1% for each position switch.
The buy-and-hold approach generated a CAGR of 14.6%, while the regime-based approach generated 15%. The more noticeable difference was in maximum drawdown, which reduced from approximately 26% to 18%.
The return improvement was small, but the reduction in drawdown was interesting. It suggests that identifying market conditions may be worth exploring from a portfolio risk management perspective, rather than using machine learning purely to predict price direction.
There is an important limitation here. The synthetic data was generated with different underlying volatility and return characteristics. The model was therefore working with data that already contained distinct market conditions.
I would like to repeat this experiment using actual Nifty 50 historical data and compare the results against a simple rolling volatility threshold. That would help determine whether the additional complexity of a Gaussian Mixture Model provides any meaningful benefit.
This is a personal financial modelling experiment, not an investment recommendation.