OPEN-SOURCE SCRIPT
Sample Entropy (SampEn) Regime Detector

Sample 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.
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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。