OPEN-SOURCE SCRIPT
AetherEdge AI Dynamic Trendline Architect

🖊️ Overview
AetherEdge AI Dynamic Trendline Architect is a next-generation automatic trendline system powered by a four-layer AI architecture: pivot detection, KNN pattern memory, a neural quality network, and structural prior validation. Every candidate line is evaluated through machine learning, ensuring that only truly meaningful, high-quality lines are drawn and lifecycle-managed — delivering accuracy and practicality unreachable by conventional approaches.
🔶 Key Features
Pivot Engine: High-precision swing high/low detection with dynamic candidate pairing
5D Feature Extraction: Slope, duration, volatility ratio, RSI state, angle
KNN Pattern Memory: Stores up to 300 historical line patterns
Neural Quality Network: Online learning updates quality scores in real time
Structural Prior: Physical validation via touch counts and violations
Dynamic Hybrid Fusion: Mixes NN predictions with structural prior
Line Lifecycle Management: TTL, break detection, minimum score threshold
Break Detection: ATR-buffered to suppress false signals
Premium Visuals: Age fading, strength labels, support/resistance color coding
🧠 Technical Architecture
This indicator is a multi-layer decision system centered on AI-based line quality evaluation.
Pivot Engine: Detects swings via ta.pivothigh/low, maintaining up to 25 pivots per side. From each new pivot, candidate pairs are generated by scanning back scanBack pivots.
Feature Engineering: ①ATR-normalized slope, ②normalized duration, ③ATR-ratio volatility, ④RSI deviation, ⑤atan-based angle — all standardized to [-2, 2] or [-1, 1].
KNN Pattern Memory: Up to maxMemory historical patterns with outcome labels. Each candidate undergoes Euclidean distance comparison in the 5D feature space; Top-K neighbors are weighted by inverse distance to produce a consensus score.
Neural Quality Network: An online neural net learns to predict line quality, updated via real outcomes (breaks, bounces) over nnEpochs.
Structural Prior: Physically verifies the line by counting actual touches and violations along its projection, computing touchScore + durationQuality − violationPenalty.
Hybrid Score Fusion: priorMix dynamically blends NN prediction with structural prior — only lines with consensus from both layers reach top-tier scoring.
Line Lifecycle: Only lines above minScore are drawn; ttlBars triggers auto-expiry; breaks exceeding breakBuf × ATR change color and are recorded.
⚙️ Recommended Settings & Tuning Guide
Crypto Defaults:
BTC/ETH (4H–1D): pivLen=5, maxLines=6, ttlBars=80, minScore=0.55
SOL/XRP (1H): pivLen=4, maxLines=8, ttlBars=60, minScore=0.50
Scalping (5M–15M): pivLen=3, maxLines=4, ttlBars=40, knnK=3
Long Swing (1D): pivLen=8, maxLines=10, ttlBars=200, minScore=0.65
Parameter Tuning:
Too many lines: Raise minScore to 0.65–0.75 to display only premium lines
Too few lines: Increase scanBack to 6 and lower minScore to 0.45
Choppy markets: Raise breakBuf to 0.30 to avoid fake breaks
Quiet ranges: Set priorMix=0.6 for structure-favored detection
Trending markets: Set priorMix=0.3 to leverage NN learning
💡 How to Use in Practice
High-Score Line Reversal: Long at score ≥ 0.70 supports, short at resistances
Breakout Strategy: Color shifts (colBkU/colBkD) signal trend-following entries
S/R Flip: Capture the moment a broken resistance flips to support
Multi-Timeframe: Use 1D strong lines as zones for 1H precision entries
AetherEdge Combinations: Hybrid AI Bias bullish + high-score support bounce = elite long setup
⚠️ Important Notes
NN weights start from defaults; memory requires 50–100 events to mature
KNN memory and NN weights reset on indicator reload
Too-small pivLen creates noise; too-large delays detection
Excessive maxLines clutters the chart
Extreme gaps or flash crashes may trigger false break detection
🚨 Disclaimer
This indicator is provided for educational and research purposes only and does not constitute financial advice. AI predictions and line quality scores 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.
AetherEdge AI Dynamic Trendline Architect is a next-generation automatic trendline system powered by a four-layer AI architecture: pivot detection, KNN pattern memory, a neural quality network, and structural prior validation. Every candidate line is evaluated through machine learning, ensuring that only truly meaningful, high-quality lines are drawn and lifecycle-managed — delivering accuracy and practicality unreachable by conventional approaches.
🔶 Key Features
Pivot Engine: High-precision swing high/low detection with dynamic candidate pairing
5D Feature Extraction: Slope, duration, volatility ratio, RSI state, angle
KNN Pattern Memory: Stores up to 300 historical line patterns
Neural Quality Network: Online learning updates quality scores in real time
Structural Prior: Physical validation via touch counts and violations
Dynamic Hybrid Fusion: Mixes NN predictions with structural prior
Line Lifecycle Management: TTL, break detection, minimum score threshold
Break Detection: ATR-buffered to suppress false signals
Premium Visuals: Age fading, strength labels, support/resistance color coding
🧠 Technical Architecture
This indicator is a multi-layer decision system centered on AI-based line quality evaluation.
Pivot Engine: Detects swings via ta.pivothigh/low, maintaining up to 25 pivots per side. From each new pivot, candidate pairs are generated by scanning back scanBack pivots.
Feature Engineering: ①ATR-normalized slope, ②normalized duration, ③ATR-ratio volatility, ④RSI deviation, ⑤atan-based angle — all standardized to [-2, 2] or [-1, 1].
KNN Pattern Memory: Up to maxMemory historical patterns with outcome labels. Each candidate undergoes Euclidean distance comparison in the 5D feature space; Top-K neighbors are weighted by inverse distance to produce a consensus score.
Neural Quality Network: An online neural net learns to predict line quality, updated via real outcomes (breaks, bounces) over nnEpochs.
Structural Prior: Physically verifies the line by counting actual touches and violations along its projection, computing touchScore + durationQuality − violationPenalty.
Hybrid Score Fusion: priorMix dynamically blends NN prediction with structural prior — only lines with consensus from both layers reach top-tier scoring.
Line Lifecycle: Only lines above minScore are drawn; ttlBars triggers auto-expiry; breaks exceeding breakBuf × ATR change color and are recorded.
⚙️ Recommended Settings & Tuning Guide
Crypto Defaults:
BTC/ETH (4H–1D): pivLen=5, maxLines=6, ttlBars=80, minScore=0.55
SOL/XRP (1H): pivLen=4, maxLines=8, ttlBars=60, minScore=0.50
Scalping (5M–15M): pivLen=3, maxLines=4, ttlBars=40, knnK=3
Long Swing (1D): pivLen=8, maxLines=10, ttlBars=200, minScore=0.65
Parameter Tuning:
Too many lines: Raise minScore to 0.65–0.75 to display only premium lines
Too few lines: Increase scanBack to 6 and lower minScore to 0.45
Choppy markets: Raise breakBuf to 0.30 to avoid fake breaks
Quiet ranges: Set priorMix=0.6 for structure-favored detection
Trending markets: Set priorMix=0.3 to leverage NN learning
💡 How to Use in Practice
High-Score Line Reversal: Long at score ≥ 0.70 supports, short at resistances
Breakout Strategy: Color shifts (colBkU/colBkD) signal trend-following entries
S/R Flip: Capture the moment a broken resistance flips to support
Multi-Timeframe: Use 1D strong lines as zones for 1H precision entries
AetherEdge Combinations: Hybrid AI Bias bullish + high-score support bounce = elite long setup
⚠️ Important Notes
NN weights start from defaults; memory requires 50–100 events to mature
KNN memory and NN weights reset on indicator reload
Too-small pivLen creates noise; too-large delays detection
Excessive maxLines clutters the chart
Extreme gaps or flash crashes may trigger false break detection
🚨 Disclaimer
This indicator is provided for educational and research purposes only and does not constitute financial advice. AI predictions and line quality scores 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.
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.