OPEN-SOURCE SCRIPT
Entropy Momentum Filter [EMF] -FibonacciFlux

Entropy Momentum Filter [EMF]
What it does
Measures directional conviction in price action using Shannon entropy of log returns. Low entropy means strong directional conviction — the market is trending. High entropy means indecision — the market is ranging or chaotic.
How it works
Key Features
How to use
Inputs
Works on all timeframes and instruments. Particularly effective as a regime filter combined with trend-following or mean-reversion strategies.
What it does
Measures directional conviction in price action using Shannon entropy of log returns. Low entropy means strong directional conviction — the market is trending. High entropy means indecision — the market is ranging or chaotic.
How it works
- Entropy Calculation: Builds a histogram of log returns over a rolling lookback window, then computes Shannon entropy H = -sum(p * ln(p))
- Normalization: Divides by ln(N) to produce a 0-1 scale where 0 = perfect order and 1 = maximum randomness
- Color Gradient: Green (low entropy, conviction) → Gray (neutral) → Red (high entropy, indecision)
- Reference Lines: 0.3 low entropy threshold, 0.5 midpoint, 0.7 high entropy threshold
Key Features
- Single clean concept — Shannon entropy applied to price changes
- Normalized 0-1 output — no parameter-dependent interpretation needed
- Built-in alert for conviction spikes (entropy drops below 0.3)
- Only 2 inputs: lookback period and histogram bin count
- Lightweight — minimal computational overhead
How to use
- Conviction filter: Only take trend-following trades when entropy is below 0.5
- Range detection: High entropy (>0.7) suggests avoid trend strategies or switch to mean-reversion
- Conviction spike alert: Built-in alert fires when entropy drops below 0.3 — strong move likely starting
- Combine with directional indicators: Use EMF as a filter on top of your existing signals
Inputs
- Lookback period (default 20) — rolling window for entropy calculation
- Histogram bins (default 10) — granularity of the return distribution
Works on all timeframes and instruments. Particularly effective as a regime filter combined with trend-following or mean-reversion strategies.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。