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.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
FibonacciFlux: Pushing indicator boundaries. Crafting sophisticated, surprising tools via ambitious R&D.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.