# Gaussian Mixture Models

Fits a two- or three-component Gaussian mixture to returns and volatility over a rolling 200-observation window, plotting each regime's probability from 0 to 100% with variance-ordered components, confidence-scaled candle coloring and an EM diagnostics dashboard. Defaults to 2 components, warm-start updates and 3-bar probability smoothing, for traders who want probabilistic regime context.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 1, 2026.
- Access: free.
- Concepts: [Gaussian Mixture Models](https://www.luxalgo.com/library/concept/gaussian-mixture-models/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=yr582ixwfzd4cxj1mujstbf0
- Page: https://www.luxalgo.com/library/indicator/gaussian-mixture-models/

**Gaussian Mixture Models** fits a [Gaussian mixture model](https://www.luxalgo.com/library/concept/gaussian-mixture-models/) to recent returns and volatility, plotting each fitted regime's probability for the current bar from 0 to 100% in a dedicated pane. Components are re-estimated by expectation-maximization over a rolling 200-observation window and ordered by variance, so the first line is always the calm regime and the last the stressed one. Candles tint by regime, opacity scaling on confidence; a dashboard reports weights, means and EM status.

## How to Trade the Gaussian Mixture Models?

- **Calm regime dominant**: the lowest-variance component leads, the backdrop for quiet-market tactics.
- **Stressed regime dominant**: the highest-variance component leads. Reduce risk; it is not a directional call.
- **Middling probabilities**: the bar sits between regimes; wait for a confident reading.
- **Low-Likelihood Anomaly alert**: the bar resembles nothing in the training window. Treat labels with suspicion.

Alerts fire on each dominant-regime change; as across the [machine learning family](https://www.luxalgo.com/library/family/machine-learning/), the output describes the fitted window, never the future.

## Gaussian Mixture Models Settings

- **Components** (default 2): 3 adds a middle transition tier.
- **Features** (default Returns + Volatility): the observation vector.
- **Return Source** (default close): feeds the log returns.
- **Volatility Measure** (default Stdev of Returns) with **Volatility Length** (default 14): the volatility feature and its lookback; or ATR %.
- **Training Window** (default 200): rolling observations per fit.
- **Max EM Steps per Bar** (default 10): update cap per bar.
- **Update Mode** (default Incremental (Warm Start)): or a full refit each bar.
- **Probability Smoothing** (default 3): EMA on the probabilities.
- **Anomaly Percentile** (default 5): likelihood cutoff for anomaly flags.
- **Fit on Closed Bars** (default enabled): confirmed bars only.
- **Dashboard & style**: placement, gradient, bar coloring, anomaly markers.

## Frequently Asked Questions

### How do Gaussian Mixture Models differ from Spectral Clustering?
The mixture is a probability model: each bar gets soft membership odds per regime. [Spectral Clustering](https://www.luxalgo.com/library/indicator/spectral-clustering/) also groups behavior without labels, but commits to one hard label per bar.

### Do the probabilities forecast direction?
No. They report how the current bar compares with the recent training window: context for sizing and strategy selection, not a directional call.

### Why do readings drift over time?
The window rolls: each new observation replaces the oldest and the mixture is re-estimated, so parameters drift with the market. Variance ordering pins the labels; boundaries travel with the fit.

## Related indicators

- [SuperTrend AI (Clustering)](https://www.luxalgo.com/library/indicator/supertrend-ai-clustering/) (K-means Regime Clustering): markdown at https://www.luxalgo.com/library/indicator/supertrend-ai-clustering.md
- [Machine Learning Moving Average](https://www.luxalgo.com/library/indicator/machine-learning-moving-average/) (K-means Regime Clustering): markdown at https://www.luxalgo.com/library/indicator/machine-learning-moving-average.md
- [AI SuperTrend Clustering Oscillator](https://www.luxalgo.com/library/indicator/ai-supertrend-clustering-oscillator/) (K-means Regime Clustering): markdown at https://www.luxalgo.com/library/indicator/ai-supertrend-clustering-oscillator.md
- [Machine Learning Trendlines Cluster](https://www.luxalgo.com/library/indicator/machine-learning-trendlines-cluster/) (K-means Regime Clustering): markdown at https://www.luxalgo.com/library/indicator/machine-learning-trendlines-cluster.md
- [AI Channels (Clustering)](https://www.luxalgo.com/library/indicator/ai-channels-clustering/) (K-means Regime Clustering): markdown at https://www.luxalgo.com/library/indicator/ai-channels-clustering.md
- [Correlation Clusters](https://www.luxalgo.com/library/indicator/correlation-clusters/) (K-means Regime Clustering): markdown at https://www.luxalgo.com/library/indicator/correlation-clusters.md
- [KNN Supertrend Horizon](https://www.luxalgo.com/library/indicator/knn-supertrend-horizon/) (Machine Learning): markdown at https://www.luxalgo.com/library/indicator/knn-supertrend-horizon.md
- [Nadaraya-Watson Envelope](https://www.luxalgo.com/library/indicator/nadaraya-watson-envelope/) (Machine Learning): markdown at https://www.luxalgo.com/library/indicator/nadaraya-watson-envelope.md

---

Source: https://www.luxalgo.com/library/indicator/gaussian-mixture-models/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
