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.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.