OPEN-SOURCE SCRIPT
Hilbert Bandwidth [LB]

🔬 Concept
The Hilbert Bandwidth Index, derived from John Ehlers' analytic signal approach, measures the instantaneous stability of the dominant market cycle by computing the bandwidth — the absolute deviation between the raw instantaneous period and its smoothed counterpart. A narrow bandwidth indicates a clean, well-defined cycle suitable for trading.
📐 Mathematical Foundation
The price median is transformed via a 7‑coefficient FIR Hilbert Transform to extract the analytic signal's real and imaginary components :
real = 0.0962·P[t] + 0.5769·P[t-2] - 0.5769·P[t-4] - 0.0962·P[t-6]
imag = 0.0962·P[t-1] + 0.5769·P[t-3] - 0.5769·P[t-5] - 0.0962·P[t-7]
The instantaneous phase φ is obtained via the two‑argument arctangent of imag and real. After exponential smoothing, the phase difference Δφ between consecutive bars yields the instantaneous period :
T = 2π / |Δφ|
Finally, the bandwidth is defined as :
B = |T - EMA(T, L)|
where L is the period smoothing length. The result is expressed in bars.
🎯 What Problem Does It Solve ?
Traditional cycle indicators assume a persistent dominant cycle, producing unreliable signals during chaotic or transitional markets — the Hilbert Bandwidth quantifies cycle cleanliness in real time, allowing traders to filter out low‑quality cyclic signals and act only when the market exhibits a stable, tradeable rhythm.
📊 How To Interpret
Bandwidth below threshold (background colored) → the dominant cycle is narrow, well‑defined, and stable ; trend‑following and cycle‑based strategies have higher probability of success.
Bandwidth above threshold → the cycle is broad and unstable ; the market is either noisy or in transition ; avoid cycle‑dependent entries.
Bandwidth rapidly contracting → the market is shifting from chaos to order ; anticipate a breakout or the emergence of a clean trend.

⚙️ Parameters
Phase Smoothing – exponential smoothing length applied to the instantaneous phase (default 50) ; higher values stabilize the phase estimate but introduce lag.
Period Smoothing – EMA length applied to the instantaneous period (default 10) ; controls the responsiveness of the bandwidth calculation.
Narrow Band Threshold – the bandwidth value in bars below which the cycle is considered "clean" (default 3.0) ; the background is highlighted when bandwidth falls below this level.
📚 Reference
Ehlers J.F., "Rocket Science for Traders : Digital Signal Processing Applications", Chapter 7 – The Hilbert Transform, John Wiley & Sons, 2001.
Ehlers J.F., "Cycle Analytics for Traders", Chapter 9 – Bandwidth Measurement, John Wiley & Sons, 2014.
The Hilbert Bandwidth Index, derived from John Ehlers' analytic signal approach, measures the instantaneous stability of the dominant market cycle by computing the bandwidth — the absolute deviation between the raw instantaneous period and its smoothed counterpart. A narrow bandwidth indicates a clean, well-defined cycle suitable for trading.
📐 Mathematical Foundation
The price median is transformed via a 7‑coefficient FIR Hilbert Transform to extract the analytic signal's real and imaginary components :
real = 0.0962·P[t] + 0.5769·P[t-2] - 0.5769·P[t-4] - 0.0962·P[t-6]
imag = 0.0962·P[t-1] + 0.5769·P[t-3] - 0.5769·P[t-5] - 0.0962·P[t-7]
The instantaneous phase φ is obtained via the two‑argument arctangent of imag and real. After exponential smoothing, the phase difference Δφ between consecutive bars yields the instantaneous period :
T = 2π / |Δφ|
Finally, the bandwidth is defined as :
B = |T - EMA(T, L)|
where L is the period smoothing length. The result is expressed in bars.
🎯 What Problem Does It Solve ?
Traditional cycle indicators assume a persistent dominant cycle, producing unreliable signals during chaotic or transitional markets — the Hilbert Bandwidth quantifies cycle cleanliness in real time, allowing traders to filter out low‑quality cyclic signals and act only when the market exhibits a stable, tradeable rhythm.
📊 How To Interpret
Bandwidth below threshold (background colored) → the dominant cycle is narrow, well‑defined, and stable ; trend‑following and cycle‑based strategies have higher probability of success.
Bandwidth above threshold → the cycle is broad and unstable ; the market is either noisy or in transition ; avoid cycle‑dependent entries.
Bandwidth rapidly contracting → the market is shifting from chaos to order ; anticipate a breakout or the emergence of a clean trend.
⚙️ Parameters
Phase Smoothing – exponential smoothing length applied to the instantaneous phase (default 50) ; higher values stabilize the phase estimate but introduce lag.
Period Smoothing – EMA length applied to the instantaneous period (default 10) ; controls the responsiveness of the bandwidth calculation.
Narrow Band Threshold – the bandwidth value in bars below which the cycle is considered "clean" (default 3.0) ; the background is highlighted when bandwidth falls below this level.
📚 Reference
Ehlers J.F., "Rocket Science for Traders : Digital Signal Processing Applications", Chapter 7 – The Hilbert Transform, John Wiley & Sons, 2001.
Ehlers J.F., "Cycle Analytics for Traders", Chapter 9 – Bandwidth Measurement, John Wiley & Sons, 2014.
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.
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.
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.