OPEN-SOURCE SCRIPT

AetherEdge - Adaptive Risk Engine

189
🖊️ 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.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.