OPEN-SOURCE SCRIPT

AetherEdge - Fractal Geometry + Diffusion Predictor

413
🖊️ Overview

A geometric forecaster unlike any channel or trendline tool. Two ideas combine. First, fractal geometry — a Higuchi-style fractal-dimension estimate and a Hurst-like persistence exponent quantify the market's self-similarity (roughness vs. smoothness). A rough, mean-reverting tape and a smooth, trending one have distinct fractal signatures, and the engine reads which regime is live. Second, diffusion-style generation — echoing how a diffusion model denoises noise into data, the engine seeds many noise vectors and runs a guided reverse process to GENERATE multiple future price paths. Their drift and volatility structure are conditioned on the fractal signature, so trending regimes generate persistent paths and rough regimes generate mean-reverting ones. Visualization: a central forecast line (the mean of generated paths) plus a faint fan of prediction bands whose opacity encodes probability.

🔶 Key Features

Fractal dimension — Higuchi method quantifies market roughness (self-similarity) as D∈[1,2]
Hurst persistence exponent — distinguishes trend-persistence (H>0.5) from mean-reversion (H<0.5)
Diffusion-style path generation — generates multiple future paths by guided reverse diffusion from noise
Fractal guidance — the self-similarity signature steers path drift (classifier-style guidance)
Multi-scenario forecasting — samples many paths to build a per-step distribution
Geometric prediction fan — a central line plus nested probability bands fanning out with horizon
Probability via opacity — band opacity follows Gaussian mass (inner = higher probability = denser)
Intelligence panel — fractal dimension, Hurst exponent, persistence, and the forecast target price at a glance

🧠 Technical Architecture

Fractal geometry: the Higuchi estimator computes the curve length L(k) at each interval k and derives the dimension D from the least-squares slope of log L(k) vs log(1/k). Higher D means a rougher (noisier) series; lower means smoother (more trending). In parallel, a rescaled-range (R/S)-style Hurst exponent is estimated as H = log(R/S) / log(n). The two combine into a persistence score ∈ [-1,1] (+1 strongly trending, −1 strongly mean-reverting).
Diffusion generation: for each path, starting from the current price, each future step runs a reverse-diffusion process over Denoising Steps iterations. Each denoise step shrinks the noise amplitude along a cosine schedule (noisy early, clean late) while progressively strengthening a fractal-guided drift (guidance bites as the noise clears — classifier-style guidance). When persistence is negative (a mean-reverting regime), a pull-back force toward the starting price is added. Repeated across Generated Paths paths, the per-step mean and variance are accumulated via Welford's online algorithm.
Visualization: the per-step mean price forms the central line, and nested bands at multiples of the standard deviation (±k·σ) form the fan. Band opacity is proportional to Gaussian mass exp(−0.5k²), denser inside (higher probability). The fan naturally widens with horizon as variance grows.

⚙️ Recommended Settings & Tuning Guide

BTC (1H–4H): Fractal Window 40, kMax 5, Persistence Window 50, Generated Paths 24, Denoising Steps 8, Horizon 16. Standard settings fit well
ETH (1H–4H): As BTC, with Fan Width 1.0 for standard spread
SOL (15m–1H): High volatility favors Noise Scale 1.2 / Fan Width 1.2 to widen path dispersion, Fractal Guidance 0.5 to soften guidance
XRP (1H–4H): Spike-prone; Persistence Window 40 to weight recent self-similarity, Paths 30 to smooth the distribution
Fractal Window / kMax: a wider window and higher kMax refine the dimension estimate but add compute; 40/5 is practical
Generated Paths: more smooths the distribution but is heavier; 20–40 is a practical balance
Denoising Steps: more smooths paths; ~8 is sufficient
Fractal Guidance: higher lets the fractal signature steer drift more; lower is noise-driven
Render load: the fan draws Fan Bands × Horizon × 2 boxes, so maxing both can hit the 500-object render cap

💡 How to Use in Practice

Reacting to the central line: the mean of generated paths is the most probable future path — its slope and target price are the forecast's core
Reading the fan: a narrow fan = high forecast confidence (paths converge); wide = high uncertainty (paths diverge); the dense inner bands are the high-probability zone
Using the fractal regime: in high-persistence (trending) conditions, follow the central line's direction; in low (mean-reverting), expect the forecast to pull back
Reading fractal dimension: low D (toward 1.0) = smooth trending tape; high (toward 2.0) = rough range/noise — an aid to regime classification
Checking Hurst: H>0.5 trend-persistent, H<0.5 reversion-prone — corroborates the central forecast's direction
Fan width and risk: tighten stops when the fan is narrow, give room when wide
Multi-timeframe usage: confirm the fractal regime and forecast direction on the higher timeframe (4H), then time entries on the lower one (15m–1H)

⚠️ Important Notes

Initial computation period: until the fractal and Hurst windows fill (tens to a hundred-plus bars), the dimension and persistence estimates are unstable; treat forecasts as low-confidence until then
Stochastic generation: diffusion paths are generated from noise seeds, so changing the seed (settings) changes the distribution — forecasts are probabilistic scenario sets, not deterministic
Interpreting the fan: the fan shows where generated paths landed, not a guarantee that price stays within it — it is a probability-density visualization
On look-ahead: fractal dimension, Hurst, and drift are all computed from confirmed past data; the forecast projects from now into the future and can of course be wrong — always forward-test
Render load: box count is Fan Bands × Horizon; lower either if it feels heavy
Constraints: this is a lightweight implementation within Pine's compute budget; the Higuchi dimension, Hurst, and path generation are all approximations

🚨 Disclaimer

This indicator is an analytical and educational visualization tool. The fractal dimension, Hurst exponent, diffusion-style path generation, prediction fan, and central line are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Even a probabilistically generated forecast can be wrong. Always combine any tool with your own analysis and disciplined risk management.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.