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.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.