Indicator · Pine Script v5 · On the chart

The 5 Market Regimes - Probabilistic Engine

by tthanhvu002sgu

Classifies the market into five regimes using fuzzy-logic scores built from log returns.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code260
Settings4inputs
LicenceNone stated
Last update3 months ago14 Jul 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

The 5 Market Regimes - Probabilistic Engine estimates a Hurst-like exponent from a variance ratio and measures skewness over a window whose length adapts: the more random the market looks, the shorter the window. A slope measure uses a rate-of-change period. Inputs set the base, minimum and maximum window and the slope period. It draws on the price chart; this summary covers the visible calculation code.

Details

Published by

tthanhvu002sgu on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend, Volatility & bands, 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
Khung thời gian gốc (Base M)int20N_base
N Tối thiểu (Chaos/Lagrange)int5N_min
N Tối đa (Trending/Surfing)int50N_max
Chu kỳ Đạo hàm (Độ dốc nến)int5len_roc
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

46 stars

This indicator uses a Hidden Markov Model (HMM) framework combined with an adaptive dual moving average engine and Directional Movement Index (DMI) features to identify market regimes (bullish, bearish, or ranging/chop). It calculates regime probabilities on e

Indicator v5 AI / machine learningTrend
Updated 7 weeks ago · None stated GitHub repository of HMM Enhanced: Regime Probability

This overlay indicator plots a SuperTrend-style band on the price chart using ATR length, a selectable source, and a base factor. Optional settings enable an adaptive factor driven by rate of change, a volatility filter, K-means clustering, and an LSTM layer w

Indicator v6 TrendVolatility & bands
Updated 4 months ago · MIT GitHub repository of ML SuperTrend (Ultimate) - Auto-Optimized AI with LSTM

Chandelier Flip Radar plots an ATR trailing stop on the price chart and tracks a directional trend state. It holds a ratchet stop until an accepted flip, using close or wick extremums and a body filter so weak breaks do not change direction. Distance to the fl

Indicator v6 TrendVolatility & bands
Updated 2 days ago · MIT GitHub repository of Chandelier Flip Radar [WavesUnchained]

This indicator calculates a volatility-adaptive SuperTrend by applying k-means clustering to ATR values over a user-defined training period. It segments historical volatility into high, medium, and low clusters to dynamically adjust the SuperTrend bands to shi

Indicator v5 TrendVolatility & bands
Updated 8 months ago · None stated GitHub repository of Machine Learning Adaptive SuperTrend [AlgoAlpha]
1 stars

A chart-overlay trailing stop that adapts to market conditions. It uses Kaufman's adaptive moving average to measure how efficiently price is moving, scales an ATR-based stop distance accordingly, and optionally adds a k-nearest-neighbours pattern layer that n

Indicator v6 TrendVolatility & bands
Updated 9 months ago · None stated GitHub repository of Adaptive ML Trailing Stop

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