OPEN-SOURCE SCRIPT
Thermodynamic Market Entropy Index (TMEI)

🚀 Thermodynamic Market Entropy Index (TMEI)
The Thermodynamic Market Entropy Index (TMEI) is a professional-grade quantitative tool designed to measure structural market order and identify the transition between chaotic consolidation and explosive directional trends. Built upon the physics-derived principles of Shannon Entropy, this indicator processes real-time price distribution and institutional volume flow to map market cycles into a normalized, zero-centered oscillator (-100 to +100).
Unlike standard lagging oscillators, TMEI acts as a dynamic market regime filter, giving traders absolute clarity on whether a market is in a highly organized trend or a random, capital-draining walk (chop).
💡 Key Features
🧠 Information Entropy Core: Using Claude Shannon’s information entropy theory, TMEI discretizes price momentum into 5 distinct thermodynamic states. It continuously measures the randomness of the market, detecting when the market structure is compressing into a high-order trend or expanding into total chaos.
🛡️ The 20% No-Trade Buffer Zone (Compression Ribbon): To eliminate devastating "whipsaws" (false breakouts), TMEI features a mathematically justified ±20 neutral corridor. This zone corresponds directly to the critical RSI 45-55 equilibrium zone, keeping traders completely on the sidelines (Neutral Gray) until institutional momentum gathers enough mass to break out.
📊 Institutional Volume Validation: TMEI does not look at price in a vacuum. It integrates an algorithmic volume filter utilizing smart accumulation/distribution logic. If a breakout occurs on weak or retail-only volume, the indicator suppresses the signal line back toward the Zero Axis, shielding you from fakeouts.
⚙️ Hysteresis-Driven State Engine: Armed with a dual-threshold hysteresis filter, TMEI locks into major macro trends. Once a trend is verified, minor counter-trend pullbacks are filtered out, ensuring you hold winning positions longer without premature exit signals.
🔬 Mathematical Logic and Scaling
TMEI measures the probability matrix of 5 distinct market states over a rolling lookback window. The pure Shannon Entropy measures the total chaos in the system. The index then normalizes this value against maximum possible entropy and subjects it to a directional vector matrix (Net Bias).
Formula: Raw Order = 100 - ((Shannon Entropy / Maximum Entropy) * 100)
Final Score = Raw Order * Directional Sign * Volume Multiplier
This process translates abstract thermodynamic physics into a highly practical, bounded indicator where +100 represents perfect bullish order and -100 represents perfect bearish order.
🛠️ How to Use
1. The Structural Breakout: Monitor the signal line closely as it exits the Gray Compression Ribbon. A definitive close above +20 confirms institutional bullish expansion. A close below -20 confirms structural bearish dominance.
2. The Chaos Neutral Zone (±20): When the line is trapped inside the gray cloud, the market is in a state of maximum entropy (Random Walk/Chop). Strictly avoid directional breakout strategies here.
3. Macro Trend Expansion (±60): Entering the ±60 zones triggers a full background color canvas injection. This highlights that the asset has entered an elite, high-momentum institutional trend corridor.
4. Volume Divergences: If the asset continues to make new structural highs but the TMEI curve prints descending peaks, it indicates a massive decay in volume-price entropy—a highly reliable leading signature of a trend collapse.
🎛️ Settings
Signal Smoothing Period (14): Controls the lookback filter applied via a Weighted Moving Average (WMA) to smooth out high-frequency market noise. Increase to 21 or 25 for ultra-clean macro tracking.
Enable Volume Validation (True): Toggles the institutional smart money filter. Highly recommended for liquid stocks and crypto assets to eliminate low-volume manipulations.
📌 Credits and Origins
This script bridges information theory, statistical thermodynamics, and quantitative technical analysis. It is dedicated to professional traders who demand a purely mathematical, data-driven view of market liquidity, regime verification, and structural mechanics.
Disclaimer: All financial indicators are purely probabilistic models. TMEI is an advanced decision-support architecture and does not guarantee execution success or profits. Always utilize strict risk management protocols and predefined stop-losses.
The Thermodynamic Market Entropy Index (TMEI) is a professional-grade quantitative tool designed to measure structural market order and identify the transition between chaotic consolidation and explosive directional trends. Built upon the physics-derived principles of Shannon Entropy, this indicator processes real-time price distribution and institutional volume flow to map market cycles into a normalized, zero-centered oscillator (-100 to +100).
Unlike standard lagging oscillators, TMEI acts as a dynamic market regime filter, giving traders absolute clarity on whether a market is in a highly organized trend or a random, capital-draining walk (chop).
💡 Key Features
🧠 Information Entropy Core: Using Claude Shannon’s information entropy theory, TMEI discretizes price momentum into 5 distinct thermodynamic states. It continuously measures the randomness of the market, detecting when the market structure is compressing into a high-order trend or expanding into total chaos.
🛡️ The 20% No-Trade Buffer Zone (Compression Ribbon): To eliminate devastating "whipsaws" (false breakouts), TMEI features a mathematically justified ±20 neutral corridor. This zone corresponds directly to the critical RSI 45-55 equilibrium zone, keeping traders completely on the sidelines (Neutral Gray) until institutional momentum gathers enough mass to break out.
📊 Institutional Volume Validation: TMEI does not look at price in a vacuum. It integrates an algorithmic volume filter utilizing smart accumulation/distribution logic. If a breakout occurs on weak or retail-only volume, the indicator suppresses the signal line back toward the Zero Axis, shielding you from fakeouts.
⚙️ Hysteresis-Driven State Engine: Armed with a dual-threshold hysteresis filter, TMEI locks into major macro trends. Once a trend is verified, minor counter-trend pullbacks are filtered out, ensuring you hold winning positions longer without premature exit signals.
🔬 Mathematical Logic and Scaling
TMEI measures the probability matrix of 5 distinct market states over a rolling lookback window. The pure Shannon Entropy measures the total chaos in the system. The index then normalizes this value against maximum possible entropy and subjects it to a directional vector matrix (Net Bias).
Formula: Raw Order = 100 - ((Shannon Entropy / Maximum Entropy) * 100)
Final Score = Raw Order * Directional Sign * Volume Multiplier
This process translates abstract thermodynamic physics into a highly practical, bounded indicator where +100 represents perfect bullish order and -100 represents perfect bearish order.
🛠️ How to Use
1. The Structural Breakout: Monitor the signal line closely as it exits the Gray Compression Ribbon. A definitive close above +20 confirms institutional bullish expansion. A close below -20 confirms structural bearish dominance.
2. The Chaos Neutral Zone (±20): When the line is trapped inside the gray cloud, the market is in a state of maximum entropy (Random Walk/Chop). Strictly avoid directional breakout strategies here.
3. Macro Trend Expansion (±60): Entering the ±60 zones triggers a full background color canvas injection. This highlights that the asset has entered an elite, high-momentum institutional trend corridor.
4. Volume Divergences: If the asset continues to make new structural highs but the TMEI curve prints descending peaks, it indicates a massive decay in volume-price entropy—a highly reliable leading signature of a trend collapse.
🎛️ Settings
Signal Smoothing Period (14): Controls the lookback filter applied via a Weighted Moving Average (WMA) to smooth out high-frequency market noise. Increase to 21 or 25 for ultra-clean macro tracking.
Enable Volume Validation (True): Toggles the institutional smart money filter. Highly recommended for liquid stocks and crypto assets to eliminate low-volume manipulations.
📌 Credits and Origins
This script bridges information theory, statistical thermodynamics, and quantitative technical analysis. It is dedicated to professional traders who demand a purely mathematical, data-driven view of market liquidity, regime verification, and structural mechanics.
Disclaimer: All financial indicators are purely probabilistic models. TMEI is an advanced decision-support architecture and does not guarantee execution success or profits. Always utilize strict risk management protocols and predefined stop-losses.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.