OPEN-SOURCE SCRIPT
Higuchi Fractal Dimension [forexobroker]

Higuchi Fractal Dimension estimates the fractal dimension D of the price curve in a bounded [1, 2] interval: D close to 1 means smooth and trending, D close to 2 means jagged and random. The simplified two-scale variant (k = 1 and k = 4) gives a fast, deterministic estimator suitable for live charts.
🔶 ALGORITHM
1. L(1) = average absolute single-bar move over the window: sum |close - close[i+1]| / (N - 1).
2. L(4) = average absolute four-bar move, normalised by step count.
3. Dimension D = log(L(1) / L(4)) / log(4) + 1, clipped to [1, 2].
4. Smooth regime when D <= threshold.
5. Direction comes from close vs trend SMA.
🔶 SIGNAL LOGIC
- Buy: smooth regime AND close > SMA AND close crosses SMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: smooth regime AND close < SMA AND close crosses SMA down.
- Position-lock state machine.
🔶 INPUTS
- Higuchi Window (default 60)
- Trend SMA Length (default 20)
- Smooth Threshold (default 1.65)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, SMA toggle, buy / sell colors
🔶 ALERTS
HFD Buy, HFD Sell, HFD Any Signal, HFD Smooth On, HFD Smooth Off, HFD Strong Trend, HFD Strong Chop, HFD SMA Cross Up, HFD Webhook JSON.
🔶 LIMITATIONS
- Two-scale (k = 1, k = 4) approximation is faster but less accurate than the full Higuchi method (k = 1..k_max).
- D depends on price scale, partly mitigated by ratio formulation; on extremely thin instruments the estimator can saturate.
- Threshold 1.65 is calibrated to liquid majors / indices; faster instruments may need a lower threshold.
- "Random walk" is theoretical D = 1.5; real charts often show D between 1.4 and 1.7 even in clearly trending sessions.
🔶 ALGORITHM
1. L(1) = average absolute single-bar move over the window: sum |close - close[i+1]| / (N - 1).
2. L(4) = average absolute four-bar move, normalised by step count.
3. Dimension D = log(L(1) / L(4)) / log(4) + 1, clipped to [1, 2].
4. Smooth regime when D <= threshold.
5. Direction comes from close vs trend SMA.
🔶 SIGNAL LOGIC
- Buy: smooth regime AND close > SMA AND close crosses SMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: smooth regime AND close < SMA AND close crosses SMA down.
- Position-lock state machine.
🔶 INPUTS
- Higuchi Window (default 60)
- Trend SMA Length (default 20)
- Smooth Threshold (default 1.65)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, SMA toggle, buy / sell colors
🔶 ALERTS
HFD Buy, HFD Sell, HFD Any Signal, HFD Smooth On, HFD Smooth Off, HFD Strong Trend, HFD Strong Chop, HFD SMA Cross Up, HFD Webhook JSON.
🔶 LIMITATIONS
- Two-scale (k = 1, k = 4) approximation is faster but less accurate than the full Higuchi method (k = 1..k_max).
- D depends on price scale, partly mitigated by ratio formulation; on extremely thin instruments the estimator can saturate.
- Threshold 1.65 is calibrated to liquid majors / indices; faster instruments may need a lower threshold.
- "Random walk" is theoretical D = 1.5; real charts often show D between 1.4 and 1.7 even in clearly trending sessions.
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.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
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.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
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.