Sample Entropy (SampEn) Regime DetectorSample Entropy (SampEn) Regime Detector (V6)
This indicator introduces Sample Entropy (SampEn) to TradingView—a sophisticated complexity measure used in algorithmic trading and academia to quantify how predictable or chaotic price behavior is. Unlike Approximate Entropy (ApEn), SampEn eliminates self-matching bias, making it far more reliable for financial time series.
How it works:
The indicator analyzes a rolling window of price action to find repeating patterns.
Low SampEn (Green Background): Indicates high regularity. The market is in a structured phase (strong trend or clean mean-reversion). Your standard strategies (RSI, MACD, Moving Averages) are most effective here.
High SampEn (Red Background): Indicates pure randomness or "Chop." The market lacks a tradable pattern. This is where most "fake-outs" happen.
Adaptive EMA (Yellow Line): This is a dynamic moving average that adjusts its smoothing based on entropy. In predictable regimes, it tightens to track price; in chaotic regimes, it slows down to filter out noise.
How to use it:
Regime Filter: Use the background colors as a "Traffic Light." Only take trades when the background is Green (Predictable) or neutral.
Risk Management: If the SampEn Score (top right) is above 2.0, consider reducing your position size or tightening your Stop-Loss, as the market is entering a high-noise phase.
Breakout Confirmation: A sudden drop in entropy (shifting from Red to Green) often signals the start of a massive, organized move.
Key Features:
V6 Engine: Optimized for the latest Pine Script performance.
Adaptive Smoothing: EMA speed changes bar-by-bar based on market chaos.
Professional Alerts: Built-in alerts for regime changes to reduce screen fatigue.
Pine Script® インジケーター


