OPEN-SOURCE SCRIPT
AetherEdge - Inefficiency Refill Model

🖊️ Overview
AE-IRM detects inefficient price moves made on thin volume — "voids" — and learns the probability that they are refilled (mean-revert) along with how long that takes. Many tools merely flag voids; AE-IRM answers "will it refill, and when?" with two learning layers. Surges and drops without participation tend statistically to be retraced, and this quantifies that probability and timing.
🔶 Key Features
A void oscillator that emphasizes low-participation inefficient moves (amplifies below-average-volume moves)
A learned refill probability — online logistic learns P(refill within N bars) from realized outcomes
A survival model — estimates timing (median bars-to-fill, average fill latency) from hazards
Fade (mean-reversion) signals: buy-side void → SHORT, sell-side void → LONG
A gold HUD showing void side, refill probability, median/average fill bars, pending voids, regime
Voids resolve on realized price — no repaint, signals gate on bar close
🧠 Technical Architecture
Void detection: standardized log-return retZ is multiplied by 1 if volume is below average and by a fade factor otherwise, giving osc. When |osc| exceeds a threshold a "void event" fires. The refill target (origin) is the price a few bars before the move departed.
Refill probability (ML): six features — void magnitude, participation shortfall, move extremeness, efficiency ratio (range/trend), volatility regime, and distance to origin (ATR) — are standardized online (EWMA), and an online logistic regression learns P(refill). Each void is trained at resolution with its realized label (filled, or censored at N bars) — no lookahead.
Survival (hazard / Kaplan-Meier-style): each pending void is tracked; at resolution a life table over age buckets (reached/filled) is updated. Per-bucket hazard h = filled/reached builds a survival curve S = Π(1 − h), and the age at which cumulative fill probability reaches 50% is the median bars-to-fill. Censored voids (unfilled at N) are correctly counted in the risk set.
Honest scope: a linear logistic classifier plus a nonparametric survival estimate. Not deep learning, and not a guarantee of refill.
⚙️ Recommended Settings & Tuning Guide
Key parameters: void threshold (thr), fade factor, displacement lookback (vLook), age bucket width × count (= refill horizon N), minimum refill probability (probThr).
Raise thr → only strong inefficiencies (fewer, higher quality); lower → more detections
Lower the fade factor → stricter thin-volume condition (more strongly excludes moves on volume)
Set the refill horizon N (= bucket width × count) to the timeframe you expect reversion over
Crypto starting points (tune on your chart):
BTC / ETH (15m–1H): defaults are the baseline (thr 2.0, fade 0.3, N = 40 bars)
SOL / XRP and high-vol alts: thr 2.5 to filter noisy voids, fade 0.2 to tighten the thin-volume condition
Scalping (1–5m): bucket width ~3 for a shorter N, targeting immediate retraces
Swing (4H–daily): larger bucket width and longer N, raise warmup so the statistics fill out
Raising probThr narrows signals to voids the model finds more likely to refill
💡 How to Use in Practice
Fade (counter-trend): SHORT on a buy-side void (thin-volume surge), LONG on a sell-side void (thin-volume drop); higher refill probability = greater edge
Reading the probability: high refill probability = strong reversion expectation; low = the move may continue (trend continuation)
Timing: median/average fill bars are your take-profit guide — design exits around "fills in ~X bars"
Use the regime: in RANGE, refills work better; in TREND, voids may run without filling — read it alongside the HUD regime
Combinations: pair with AE-VECTOR's target band or AE-QUORUM's directional probability, and use IRM's probability and timing to judge whether to fade and how to size
⚠️ Important Notes
Learning period: no signals until warmup bars; the classifier and survival statistics need time to spin up
Learning reset: changing inputs, symbol, or timeframe re-learns the internal state (weights and hazards)
Probability, not a guarantee: in strong trends voids can stay unfilled (censored) for a long time — avoid fading low-probability voids
Oscillator only: it does not draw void zones on price — operate from the signals and the HUD's probability and timing
🚨 Disclaimer
This indicator is for educational and informational purposes only and is not financial advice or a recommendation to buy or sell. No method guarantees future profits; past performance does not indicate future results, and trading carries the risk of loss. All trading decisions are your own — use proper backtesting and disciplined risk management.
AE-IRM detects inefficient price moves made on thin volume — "voids" — and learns the probability that they are refilled (mean-revert) along with how long that takes. Many tools merely flag voids; AE-IRM answers "will it refill, and when?" with two learning layers. Surges and drops without participation tend statistically to be retraced, and this quantifies that probability and timing.
🔶 Key Features
A void oscillator that emphasizes low-participation inefficient moves (amplifies below-average-volume moves)
A learned refill probability — online logistic learns P(refill within N bars) from realized outcomes
A survival model — estimates timing (median bars-to-fill, average fill latency) from hazards
Fade (mean-reversion) signals: buy-side void → SHORT, sell-side void → LONG
A gold HUD showing void side, refill probability, median/average fill bars, pending voids, regime
Voids resolve on realized price — no repaint, signals gate on bar close
🧠 Technical Architecture
Void detection: standardized log-return retZ is multiplied by 1 if volume is below average and by a fade factor otherwise, giving osc. When |osc| exceeds a threshold a "void event" fires. The refill target (origin) is the price a few bars before the move departed.
Refill probability (ML): six features — void magnitude, participation shortfall, move extremeness, efficiency ratio (range/trend), volatility regime, and distance to origin (ATR) — are standardized online (EWMA), and an online logistic regression learns P(refill). Each void is trained at resolution with its realized label (filled, or censored at N bars) — no lookahead.
Survival (hazard / Kaplan-Meier-style): each pending void is tracked; at resolution a life table over age buckets (reached/filled) is updated. Per-bucket hazard h = filled/reached builds a survival curve S = Π(1 − h), and the age at which cumulative fill probability reaches 50% is the median bars-to-fill. Censored voids (unfilled at N) are correctly counted in the risk set.
Honest scope: a linear logistic classifier plus a nonparametric survival estimate. Not deep learning, and not a guarantee of refill.
⚙️ Recommended Settings & Tuning Guide
Key parameters: void threshold (thr), fade factor, displacement lookback (vLook), age bucket width × count (= refill horizon N), minimum refill probability (probThr).
Raise thr → only strong inefficiencies (fewer, higher quality); lower → more detections
Lower the fade factor → stricter thin-volume condition (more strongly excludes moves on volume)
Set the refill horizon N (= bucket width × count) to the timeframe you expect reversion over
Crypto starting points (tune on your chart):
BTC / ETH (15m–1H): defaults are the baseline (thr 2.0, fade 0.3, N = 40 bars)
SOL / XRP and high-vol alts: thr 2.5 to filter noisy voids, fade 0.2 to tighten the thin-volume condition
Scalping (1–5m): bucket width ~3 for a shorter N, targeting immediate retraces
Swing (4H–daily): larger bucket width and longer N, raise warmup so the statistics fill out
Raising probThr narrows signals to voids the model finds more likely to refill
💡 How to Use in Practice
Fade (counter-trend): SHORT on a buy-side void (thin-volume surge), LONG on a sell-side void (thin-volume drop); higher refill probability = greater edge
Reading the probability: high refill probability = strong reversion expectation; low = the move may continue (trend continuation)
Timing: median/average fill bars are your take-profit guide — design exits around "fills in ~X bars"
Use the regime: in RANGE, refills work better; in TREND, voids may run without filling — read it alongside the HUD regime
Combinations: pair with AE-VECTOR's target band or AE-QUORUM's directional probability, and use IRM's probability and timing to judge whether to fade and how to size
⚠️ Important Notes
Learning period: no signals until warmup bars; the classifier and survival statistics need time to spin up
Learning reset: changing inputs, symbol, or timeframe re-learns the internal state (weights and hazards)
Probability, not a guarantee: in strong trends voids can stay unfilled (censored) for a long time — avoid fading low-probability voids
Oscillator only: it does not draw void zones on price — operate from the signals and the HUD's probability and timing
🚨 Disclaimer
This indicator is for educational and informational purposes only and is not financial advice or a recommendation to buy or sell. No method guarantees future profits; past performance does not indicate future results, and trading carries the risk of loss. All trading decisions are your own — use proper backtesting and disciplined risk management.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.