OPEN-SOURCE SCRIPT

AetherEdge Regime-Aware Trend Channel

868
🖊️ Overview
AetherEdge Regime-Aware Trend Channel is a next-generation dynamic channel system in which K-means clustering automatically classifies the market into three regimes — Range, Trend, and Volatile — and generates regime-specific channels in real time. Unlike conventional one-size-fits-all channels, it identifies the market's underlying character through unsupervised machine learning and reshapes itself accordingly. Upon breakout, it projects a confidence-decaying forward cone, visualizing "where price is likely heading next."

🔶 Key Features

Automatic K-means Regime Classification: 4 features × 3 clusters
Regime-Specific Channels: Optimal length & width per Range/Trend/Volatile
Dynamic Retraining: Centroids recompute every recalcBars to track shifts
Breakout Detection: ATR threshold + confirmation bars filter false breaks
Forward Projection: Confidence-decaying cone for projBars after breakout
Regime Color Visualization: Blue=Range / Green=Trend / Orange=Volatile
Stats Panel: Real-time regime, centroid, and feature display
Multi-Timeframe Friendly: Self-adapting design across all timeframes

🧠 Technical Architecture

This indicator is an adaptive channel AI built around unsupervised K-means learning.

4-Dimensional Feature Vector: ①EMA21–50 divergence (f1: trend strength) ②Normalized stdev (f2: volatility) ③High–low range / ATR (f3: range-ness) ④EMA21 slope (f4: directionality) — multidimensional market character.
Min-Max Normalization: All features scaled to 0–1 over trainBars window for fair distance computation.
K-means Clustering: regimeK centroids initialized evenly across trainBars → maxIter iterations of nearest-centroid assignment → centroid update until convergence.
Centroid Classification: trendScore = c1 + c4, volaScore = c2, rangeScore = 1 − c3 − c1; the maximum determines regime type per centroid.
Real-time Prediction: Computes Euclidean distance from current vector to all centroids; nearest centroid's regimeType is adopted.
Adaptive Channel Engine: Different lengths (chRangeLen / chTrendLen / chVolaLen) per regime extract highs/lows, scaled by WidthMul × ATR.
Breakout Detection: Triggered when deviation exceeds breakATRMul × ATR for breakConfirmBars consecutive bars.
Forward Projection: Cone-shaped confidence band drawn projBars ahead with projDecay exponential decay.

⚙️ Recommended Settings & Tuning Guide

Crypto Defaults:

BTC (4H): trainBars=500, regimeK=3, recalcBars=50, featureWin=20
ETH (1H): trainBars=400, regimeK=3, recalcBars=40, chTrendLen=50
SOL/XRP (15M): trainBars=300, regimeK=3, recalcBars=30, featureWin=15
Long-Term (1D): trainBars=800, regimeK=4, recalcBars=80, chTrendLen=100
Tuning Guide:

Granular classification: regimeK=4–5 (requires more data)
Fast response: recalcBars=20 for frequent retraining (heavier load)
Stability priority: recalcBars=100, maxIter=20 for robust centroids
Trend-following: trendWidthMul=2.5 for wider breakout tolerance
Mean-reversion: rangeWidthMul=0.8 for tight Range channels
Volatile markets: volaWidthMul=3.0 to suppress false signals
Conservative breakouts: breakConfirmBars=3, breakATRMul=0.7

💡 How to Use in Practice

Range Strategy: In blue regimes, fade extremes — mean-reversion plays
Trend Strategy: In green regimes, buy dips / sell rallies — trend-following
Volatile Strategy: In orange regimes, reduce size and await clean breaks
Breakout Follow-through: Enter in cone direction; consider TP at cone tail
Regime Shift Signal: Color changes mark regime transitions = strategy switch points
Multi-Timeframe: Higher-TF regime + lower-TF channel edges for entry precision
AetherEdge Synergy: When Adaptive Fibonacci AI ratios align with channel edges → ultra-high-confidence zones

⚠️ Important Notes

Regime classification is inactive until trainBars of data accumulates
K-means is initialization-sensitive; classification may fluctuate at retraining moments
Too-short recalcBars destabilizes centroids and adds noise
Sudden regime shifts may incur a few bars of lag
Excessive regimeK fragments data per cluster, reducing classification accuracy
The projection cone is a probabilistic forecast, not a price guarantee

🚨 Disclaimer

This indicator is provided for educational and research purposes only and does not constitute financial advice. K-means classification and projection forecasts are based on historical data and do not guarantee future performance. All trading decisions are made at your own risk and should be accompanied by proper risk management.

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.