The Expectation Maximization Gaussian Mixture Regime indicator clusters market states into two to five components using an online Expectation-Maximization Gaussian Mixture Model.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
Expectation Maximization Gaussian Mixture Regime processes three input features: volatility-normalized momentum, relative volatility, and relative volume. Operating in a separate pane, the indicator renders histograms, color gradients, entropy certainty metrics, and optional regime background shading, along with a diagnostics table. Users can configure learning memory length, feature lookback horizons, EM initialization thresholds, component numbers, and visual toggles.
Online Expectation-Maximization Gaussian Mixture Model
3-feature clustering using momentum, volatility, and volume
Dynamic regime classification with entropy certainty metric
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Effective learning memory
int
100
memoryLength
Gaussian components
int
3
nComponents
Initialization sample
int
75
initializationBarsInput
Initialization EM iterations
int
15
initializationIterations
EM relative tolerance
float
0.0001
convergenceTolerance
Variance floor
float
0.05
varianceFloor
Minimum component weight
float
0.01
minimumWeight
Momentum horizon
int
14
momentumLength
Short volatility horizon
int
20
volatilityLength
Relative-volume horizon
int
50
volumeLength
Feature clipping
float
6.0
featureClip
Oscillator smoothing
int
3
smoothing
Show all 23 settings
Setting
Type
Default
Variable
Show gradient
bool
true
showGradient
Show histogram
bool
true
showHistogram
Show regime background
bool
true
showRegime
Show entropy certainty
bool
true
showCertainty
Color price bars
bool
false
barColoring
Show diagnostics table
bool
true
showDiagnostics
Table position
string
Top Right
diagnosticsPositionInput
Detail level
string
Standard
diagnosticsDetailLevel
Text size
string
Tiny
diagnosticsTextSizeInput
Background transparency
int
78
diagnosticsBackgroundTransparency
Show during initialization warm-up
bool
true
showDiagnosticsDuringWarmup
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator uses a two-dimensional k-nearest-neighbours model on scaled oscillator values to classify the current bar as buy, sell, or hold from similar historical states. Users select RSI, ROC, CCI, momentum, or all of them, and set the neighbour count, fa
This indicator standardizes price inputs using z-score normalization before calculating a relative strength index (RSI). It generates trade signals when standardized price components cross over or under the standardized RSI feature. Signals can be filtered by
This indicator plots an oscillator in a separate pane. It builds several SuperTrend series across a user-defined factor range and step, using ATR as the band width. On each bar it measures the distance between the close and each SuperTrend output, then groups
PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l
This indicator calculates the Relative Strength Index (RSI) alongside a simple moving average to generate directional momentum signals in a separate pane. It supports Break Flip and Break Continuous scanning modes for long and short setups. A wide array of opt
This Pine v4 study ports early NostalgiaForInfinity V6 conditions onto the price chart. It computes two Bollinger setups, several EMAs and SMAs, RSI, MFI, a percent SMA spread labeled EWO, a 14-period choppiness value, and short and longer volume medians. Fixe