OPEN-SOURCE SCRIPT
AetherEdge - Adaptive Risk Engine

🖊️ Overview
Most sizing is a static "1% every time." AE-RISK sizes to a learned edge and volatility, and pulls risk back automatically when you're cold. It learns the trigger's win-probability online, sizes via fractional Kelly, and lays out the full per-trade risk package — ATR stop/target, $ risk and reward, and position size in units.
🔶 Key Features
Edge-linked sizing — fractional Kelly from the learned win-rate (size up only when the odds justify it)
Loss-streak throttle — scales risk down/up with realized losing/winning runs (drawdown-aware)
Adaptive stop/target — ATR stop distance, R target
Per-regime optimal R — a UCB learns the best-expectancy R per volatility regime (information, decoupled from sizing)
Full risk package — units / % equity / $ risk-reward / R:R / win-rate / Kelly f*
Level lines + trigger triangles; bar-close training — no repaint
🧠 Technical Architecture
Trigger: EMA cross (default) or Donchian breakout; used for both learning and display.
ML (online logistic): at each trigger, six features (trend alignment, momentum, RSI, vol regime, volume, breakout position) predict P(win) = P(reach the R-target before the stop within N bars) via a triple barrier over an array<Setup>, resolved conservatively with SL priority (max-favorable-excursion counted only up to the stop).
Sizing (fractional Kelly): f* = max((p(b+1)−1)/b, 0) with b = target R; risk % = Kelly fraction × f* (capped); units = equity × risk % ÷ stop distance. A vol-target size is shown for reference.
RL (UCB / per-regime optimal R): per volatility regime, a UCB learns the best-expectancy R from the realized MFE distribution, shown as "opt R" (decoupled — information, not an override).
Throttle: a realized win/loss streak scales the multiplier (down through losing runs).
Honest scope: a linear classifier + Kelly + a bandit. Not deep learning, and not financial advice.
⚙️ Recommended Settings & Tuning Guide (crypto 15m–4H)
Key parameters: equity, base/max risk %, Kelly fraction, ATR stop, target R, trigger, barrier horizon N, throttle factor.
Kelly fraction ≈ 0.2–0.3 (full Kelly overbets; stay conservative)
Always set max risk % (caps large Kelly outputs)
Design payoff with stop (ATR) / target R; consult the per-regime "opt R"
A higher throttle factor cuts risk harder on losing runs
Start from defaults for crypto 15m–1H (slMult 1.5, R 2.0, N 20); enter your real equity
💡 How to Use in Practice
Use the trigger's risk package (size / SL / TP / $ risk) as your order template
Stand aside when P(win) and Kelly f* are low (thin edge)
A throttle multiple below 1 signals poor fit with the market — go smaller
If opt R diverges from your target R, reconsider the target
Combine with AE-ACE or AE-MRB signals, using this tool to manage size and stops
⚠️ Important Notes
Needs a learning period (warmup); learning resets on parameter/timeframe change
Intrabar order is unknown, so MFE/SL resolution is a conservative approximation (it can differ from real fills)
Kelly is sensitive to the estimated win-rate — keep the fraction small and always cap risk
This is not financial advice. The displayed size is only a starting point; final decisions and orders are your own
🚨 Disclaimer
This indicator is for educational and informational purposes only and is not financial advice, a trading recommendation, or money-management advice. Displayed position sizes and risk amounts are mechanical example calculations; no method guarantees future profits. Past performance does not indicate future results, and trading carries the risk of loss. All decisions and capital allocation are your own — use proper validation and disciplined risk management.
Most sizing is a static "1% every time." AE-RISK sizes to a learned edge and volatility, and pulls risk back automatically when you're cold. It learns the trigger's win-probability online, sizes via fractional Kelly, and lays out the full per-trade risk package — ATR stop/target, $ risk and reward, and position size in units.
🔶 Key Features
Edge-linked sizing — fractional Kelly from the learned win-rate (size up only when the odds justify it)
Loss-streak throttle — scales risk down/up with realized losing/winning runs (drawdown-aware)
Adaptive stop/target — ATR stop distance, R target
Per-regime optimal R — a UCB learns the best-expectancy R per volatility regime (information, decoupled from sizing)
Full risk package — units / % equity / $ risk-reward / R:R / win-rate / Kelly f*
Level lines + trigger triangles; bar-close training — no repaint
🧠 Technical Architecture
Trigger: EMA cross (default) or Donchian breakout; used for both learning and display.
ML (online logistic): at each trigger, six features (trend alignment, momentum, RSI, vol regime, volume, breakout position) predict P(win) = P(reach the R-target before the stop within N bars) via a triple barrier over an array<Setup>, resolved conservatively with SL priority (max-favorable-excursion counted only up to the stop).
Sizing (fractional Kelly): f* = max((p(b+1)−1)/b, 0) with b = target R; risk % = Kelly fraction × f* (capped); units = equity × risk % ÷ stop distance. A vol-target size is shown for reference.
RL (UCB / per-regime optimal R): per volatility regime, a UCB learns the best-expectancy R from the realized MFE distribution, shown as "opt R" (decoupled — information, not an override).
Throttle: a realized win/loss streak scales the multiplier (down through losing runs).
Honest scope: a linear classifier + Kelly + a bandit. Not deep learning, and not financial advice.
⚙️ Recommended Settings & Tuning Guide (crypto 15m–4H)
Key parameters: equity, base/max risk %, Kelly fraction, ATR stop, target R, trigger, barrier horizon N, throttle factor.
Kelly fraction ≈ 0.2–0.3 (full Kelly overbets; stay conservative)
Always set max risk % (caps large Kelly outputs)
Design payoff with stop (ATR) / target R; consult the per-regime "opt R"
A higher throttle factor cuts risk harder on losing runs
Start from defaults for crypto 15m–1H (slMult 1.5, R 2.0, N 20); enter your real equity
💡 How to Use in Practice
Use the trigger's risk package (size / SL / TP / $ risk) as your order template
Stand aside when P(win) and Kelly f* are low (thin edge)
A throttle multiple below 1 signals poor fit with the market — go smaller
If opt R diverges from your target R, reconsider the target
Combine with AE-ACE or AE-MRB signals, using this tool to manage size and stops
⚠️ Important Notes
Needs a learning period (warmup); learning resets on parameter/timeframe change
Intrabar order is unknown, so MFE/SL resolution is a conservative approximation (it can differ from real fills)
Kelly is sensitive to the estimated win-rate — keep the fraction small and always cap risk
This is not financial advice. The displayed size is only a starting point; final decisions and orders are your own
🚨 Disclaimer
This indicator is for educational and informational purposes only and is not financial advice, a trading recommendation, or money-management advice. Displayed position sizes and risk amounts are mechanical example calculations; no method guarantees future profits. Past performance does not indicate future results, and trading carries the risk of loss. All decisions and capital allocation are your own — use proper validation and disciplined risk management.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.