Indicator · Pine Script v5 · Own pane

HMM V2 Regime

by rellis3

Classifies the market into bull, bear, range and chop regimes with a hidden Markov style model in a separate pane.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code240
Settings14inputs
LicenceNone stated
Last updateyesterday28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 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

Three standardised inputs, trend, volatility and ADX, are scored against configurable regime means and variances that can be pasted from an external training step. A self-transition probability sets how sticky regimes are, with an optional session boost outside 07:00 to 17:00 UTC and an optional VIX confidence overlay. Bars can be coloured by regime and an information table is available.

Details

Published by

rellis3 on GitHub

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Trend, AI / machine learning

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
BULL means [trendZ,volZ,adxZ]string1.0,0.0,0.7i_bull_means
BEAR means [trendZ,volZ,adxZ]string-1.0,0.0,0.7i_bear_means
RANGE means [trendZ,volZ,adxZ]string0.0,0.0,-1.0i_range_means
CHOP means [trendZ,volZ,adxZ]string0.0,1.0,0.0i_chop_means
BULL vars [trendZ,volZ,adxZ]string1.0,1.0,1.0i_bull_vars
BEAR vars [trendZ,volZ,adxZ]string1.0,1.0,1.0i_bear_vars
RANGE vars [trendZ,volZ,adxZ]string1.0,1.0,1.0i_range_vars
CHOP vars [trendZ,volZ,adxZ]string1.0,1.0,1.0i_chop_vars
Self-prob (avg diagonal A matrix)float0.90i_self_prob
Sticky outside 07:00–17:00 UTCbooltruei_session_boost
Apply VIX confidence overlaybooltruei_vix_overlay
VIX symbolstringCBOE:VIXi_vix_src
Show all 14 settings
SettingTypeDefaultVariable
Show info tablebooltruei_show_table
Colour bars by regimebooltruei_bar_col
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.

Similar Pine Scripts

This indicator combines a dynamic Seasonal Random Index (SRI) with a dynamic Karobein Oscillator and a pattern-similarity search algorithm in a separate pane. It normalizes SRI into seasoned and deseasoned series, shading the area green or red to signal trend

Indicator v4 Oscillators & momentumTrend
Updated 1 year ago · None stated GitHub repository of Similarity Search, Karobein and Seasonal Random Index

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

Indicator v5 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of AI SuperTrend Clustering Oscillator [LuxAlgo]

Markov State Engine classifies market conditions into six distinct regimes, including strong trends, weak trends, compression, and expansion. It evaluates historical state transitions using an exit-conditional Markov model with Laplace smoothing to estimate re

Indicator v6 AI / machine learningTrend
Updated 2 days ago · MIT GitHub repository of Markov State Engine [WavesUnchained]
7 stars

Lorentzian Classification is a machine learning indicator that applies a k-nearest neighbors algorithm using Lorentzian distance to analyze market patterns. It processes configurable technical indicators, including RSI, WaveTrend, CCI, and ADX, as feature vect

Indicator v6 AI / machine learningOscillators & momentum
Updated 1 year ago · MPL-2.0 GitHub repository of Lorentzian Classification
257 stars

This indicator uses a Lorentzian distance k-nearest neighbors classification algorithm to predict market direction based on up to five technical features, such as RSI, WaveTrend, CCI, and ADX. It compares current feature values against historical bar patterns

Indicator v5 AI / machine learningOscillators & momentum
Updated 6 weeks ago · None stated GitHub repository of Donald - Machine Learning Options

Machine Learning: Lorentzian Classification

by artificial-intelligence-edge
75 stars

An overlay indicator that applies a k-nearest-neighbors machine learning classifier using Lorentzian distance to predict price movement. It evaluates historical market features, such as RSI, WaveTrend, CCI, and ADX, to identify similar price-time patterns and

Indicator v6 AI / machine learningOscillators & momentum
Updated 3 days ago · MIT GitHub repository of Machine Learning: Lorentzian Classification

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers