OPEN-SOURCE SCRIPT
AetherEdge Reinforcement Filter MA

🖊️ Overview
AetherEdge Reinforcement Filter MA is a self-evolving moving average powered by a genuine Q-learning algorithm. By dynamically learning across 9 market states and 5 smoothing actions, it autonomously selects the optimal reaction speed for current conditions — a true "thinking MA" that transcends the limitations of fixed-parameter legacy averages.
🔶 Key Features
Full Q-Learning Engine: 9 states × 5 actions = 45-cell Q-table
State Discretization: 2D regime classification via volatility × trend strength
5-Tier Action Space: Auto-selects from ultra-fast to ultra-slow smoothing
Dual-Objective Reward: Balances tracking error and jitter suppression
ε-greedy Strategy: Governs the exploration-exploitation tradeoff
5-Level Slope Coloring: Intuitive trend strength visualization
Adaptive α Display: Mini label showing current learned smoothing
Momentum Reversal Alerts: Real-time directional shift notifications
🧠 Technical Architecture
This indicator faithfully implements the canonical reinforcement learning framework.
State Space: ATR%-Z-score discretizes volatility into 3 tiers (low/mid/high), ATR-normalized momentum classifies trend into 3 tiers (down/range/up), forming a 3×3=9 state space.
Action Space: 5 smoothing coefficients ranging from a=0 (α≈0.40, ultra-fast) to a=4 (α≈0.04, ultra-slow), allowing the MA to switch reaction speeds based on regime.
Reward Function: reward = −(trackErr × wTrack + smoothErr × wSmooth). Dynamic weighting prioritizes tracking in trends and smoothness in chop, resolving the classic lag-vs-noise dilemma.
Q-Learning Update: Q(s,a) ← Q(s,a) + α[r + γ·max Q(s',a') − Q(s,a)] — the standard Bellman update executes on every bar.
ε-greedy Selection: Explores randomly with probability ε, exploits the best known action otherwise — preserving adaptability to new regimes.
Parallel MA Computation: All 5 action-MAs are computed each bar; the selected one becomes the final output, enabling simultaneous evaluation and selection.
⚙️ Recommended Settings & Tuning Guide
Crypto Defaults:
BTC/ETH (4H–1D): BaseLen=20, α=0.15, γ=0.85, ε=0.10
SOL/XRP (1H): BaseLen=14, α=0.20, γ=0.80, ε=0.15 (high volatility)
Scalping (5M–15M): BaseLen=10, α=0.25, ε=0.05 (trust the learning)
Long Swing (1D–1W): BaseLen=50, α=0.10, γ=0.95 (deep discount)
Parameter Tuning:
Slow learning: Raise α to 0.20–0.30 for accelerated convergence
Excess noise: Lift γ to 0.90+ to prioritize long-term reward
New market/symbol: Increase ε to 0.20 for active exploration
Stable learning: Reduce ε to 0.03–0.05 to favor exploitation
💡 How to Use in Practice
Trend Following: Enter on Strong Up/Down color + price above/below RFMA
Exit Logic: Reduce on Flat slope, exit on opposite color emergence
Multi-Timeframe: 4H RFMA bias → 15M for precise entries
AetherEdge Combinations: Cluster Probability Line direction + RFMA slope alignment = elite conviction
Dynamic S/R: RFMA itself serves as a learning-based adaptive support/resistance
⚠️ Important Notes
Q-table initializes to zero — recommend a 200-bar warmup learning period
Learning resets on indicator reload (var variable behavior)
Excessive ε amplifies exploration noise; too low slows adaptation to new regimes
math.random() usage may cause minor recalculation drift on the same bar
🚨 Disclaimer
This indicator is provided for educational and research purposes only and does not constitute financial advice. All trading decisions are made at your own risk and should be accompanied by proper risk management. Past performance is not indicative of future results.
AetherEdge Reinforcement Filter MA is a self-evolving moving average powered by a genuine Q-learning algorithm. By dynamically learning across 9 market states and 5 smoothing actions, it autonomously selects the optimal reaction speed for current conditions — a true "thinking MA" that transcends the limitations of fixed-parameter legacy averages.
🔶 Key Features
Full Q-Learning Engine: 9 states × 5 actions = 45-cell Q-table
State Discretization: 2D regime classification via volatility × trend strength
5-Tier Action Space: Auto-selects from ultra-fast to ultra-slow smoothing
Dual-Objective Reward: Balances tracking error and jitter suppression
ε-greedy Strategy: Governs the exploration-exploitation tradeoff
5-Level Slope Coloring: Intuitive trend strength visualization
Adaptive α Display: Mini label showing current learned smoothing
Momentum Reversal Alerts: Real-time directional shift notifications
🧠 Technical Architecture
This indicator faithfully implements the canonical reinforcement learning framework.
State Space: ATR%-Z-score discretizes volatility into 3 tiers (low/mid/high), ATR-normalized momentum classifies trend into 3 tiers (down/range/up), forming a 3×3=9 state space.
Action Space: 5 smoothing coefficients ranging from a=0 (α≈0.40, ultra-fast) to a=4 (α≈0.04, ultra-slow), allowing the MA to switch reaction speeds based on regime.
Reward Function: reward = −(trackErr × wTrack + smoothErr × wSmooth). Dynamic weighting prioritizes tracking in trends and smoothness in chop, resolving the classic lag-vs-noise dilemma.
Q-Learning Update: Q(s,a) ← Q(s,a) + α[r + γ·max Q(s',a') − Q(s,a)] — the standard Bellman update executes on every bar.
ε-greedy Selection: Explores randomly with probability ε, exploits the best known action otherwise — preserving adaptability to new regimes.
Parallel MA Computation: All 5 action-MAs are computed each bar; the selected one becomes the final output, enabling simultaneous evaluation and selection.
⚙️ Recommended Settings & Tuning Guide
Crypto Defaults:
BTC/ETH (4H–1D): BaseLen=20, α=0.15, γ=0.85, ε=0.10
SOL/XRP (1H): BaseLen=14, α=0.20, γ=0.80, ε=0.15 (high volatility)
Scalping (5M–15M): BaseLen=10, α=0.25, ε=0.05 (trust the learning)
Long Swing (1D–1W): BaseLen=50, α=0.10, γ=0.95 (deep discount)
Parameter Tuning:
Slow learning: Raise α to 0.20–0.30 for accelerated convergence
Excess noise: Lift γ to 0.90+ to prioritize long-term reward
New market/symbol: Increase ε to 0.20 for active exploration
Stable learning: Reduce ε to 0.03–0.05 to favor exploitation
💡 How to Use in Practice
Trend Following: Enter on Strong Up/Down color + price above/below RFMA
Exit Logic: Reduce on Flat slope, exit on opposite color emergence
Multi-Timeframe: 4H RFMA bias → 15M for precise entries
AetherEdge Combinations: Cluster Probability Line direction + RFMA slope alignment = elite conviction
Dynamic S/R: RFMA itself serves as a learning-based adaptive support/resistance
⚠️ Important Notes
Q-table initializes to zero — recommend a 200-bar warmup learning period
Learning resets on indicator reload (var variable behavior)
Excessive ε amplifies exploration noise; too low slows adaptation to new regimes
math.random() usage may cause minor recalculation drift on the same bar
🚨 Disclaimer
This indicator is provided for educational and research purposes only and does not constitute financial advice. All trading decisions are made at your own risk and should be accompanied by proper risk management. Past performance is not indicative of future results.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.