OPEN-SOURCE SCRIPT

AetherEdge - Adaptive Smart RSI

914
🖊️ Overview

AE-ASRSI is a next-generation RSI that online-learns each instrument's truly effective overbought/oversold levels, rather than judging by fixed 70/30 lines. It transplants the core idea of Q-learning — learning action values from experience — to dynamically select the highest-performing line from a set of candidate thresholds. With its color changing the instant BUY/SELL signals are emitted, it is intuitive even for beginners.

🔶 Key Features

Dynamic OB/OS: Q-learning chooses the optimal level from candidate thresholds (60–80 / 40–20)
Color-flip signals: RSI turns red/green the moment it enters a zone, with BUY/SELL bubbles
Intuitive visuals: zone entry also tints the background — "color changed = signal" at a glance
Adaptive lines: OB/OS levels move automatically based on instrument and market regime
ε-greedy exploration: occasionally samples weaker thresholds to avoid lock-in to local optima
Neon-glow RSI plot with a refined red/green palette
Integrated HUD showing learned levels and each zone's success rate
Built-in BUY/SELL alerts

🧠 Technical Architecture

A full Q-learning implementation is too heavy for Pine, but its core idea — learn action values from experience, prefer high-value actions — is reproduced online. Five candidate thresholds each are kept for OB (60/65/70/75/80) and OS (40/35/30/25/20), with a Q-value (0–1) per candidate. When RSI crosses a candidate, its context is buffered; after the outcome horizon, a reward is generated from whether a real reaction (an ATR-scaled move against the cross direction) actually occurred, and Q is updated via Q ← Q + α(r − Q). The displayed threshold is the argmax candidate, while ε-greedy occasionally samples others to maintain exploration. Plot color flips instantly on zone detection, serving as the visual signal.

⚙️ Recommended Settings & Tuning Guide

Tuned with crypto in mind. RSI Length 14 and Smoothing ~2 are a starting point. Outcome Horizon is the bar count for evaluating reactions — 5–10 for intraday, 15–25 for swing. Reaction Threshold (ATR) sets how large a reaction counts as success; for strictness, raise to 1.5–2.0. Exploration (ε) defaults to 0.1 — higher increases exploration, lower stabilizes.

💡 How to Use in Practice

The simplest use is "trade the color flip." When RSI turns green with a BUY bubble, consider a long fading oversold; turning red with a SELL bubble, consider a short fading overbought. The HUD's learned OB/OS levels indicate the bounds actually working on this instrument — more precise than judging by fixed 70/30. If the zone success rate stably exceeds 50%, the learning is functioning. Counter-trend accuracy degrades in trending markets, so pair with trend tools and rely on this most in ranging conditions.

⚠️ Important Notes

This tool is Q-learning-inspired, not a full reinforcement-learning agent; within Pine's constraints it reproduces the core idea as online threshold selection. Learning requires accumulated data, so on new instruments or short windows the Q-values remain near initial values and behavior approaches the default thresholds. Static success rates in the HUD signal insufficient learning data. RSI is fundamentally a counter-trend tool that excels in ranges; in strong trends, signals can fire repeatedly without working well.

🚨 Disclaimer

This indicator is provided for educational and informational purposes only and does not constitute financial or investment advice. No signal guarantees future profit, and past performance does not indicate future results. All trading decisions are made at your own risk.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.