OPEN-SOURCE SCRIPT
AetherEdge Adaptive Fibonacci AI

🖊️ Overview
AetherEdge Adaptive Fibonacci AI is a machine-learning-driven adaptive Fibonacci engine that completely transcends traditional static ratios. A KNN (K-Nearest Neighbors) algorithm extracts the most similar historical regimes from up to 2,000 prior bars and learns which golden ratios actually worked in those analogous conditions. It then probabilistically computes a breakout probability for each level — a revolutionary tool that visualizes "which Fib will hold" as a forward-looking forecast.
🔶 Key Features
Dynamic Swing Detection: ATR-based filtering of meaningful swings only
KNN Similarity Engine: 6-dimensional feature × cosine similarity matching
Adaptive Fibonacci: Learns ratios that worked in similar regimes
3 Modes: Standard (fixed) / Adaptive (learned) / Hybrid (fused)
Breakout Probability Forecast: % probability displayed per level
3-Tier Color Coding: High / Mid / Low breakout probability
Predicted Extension Lines: 1.272 / 1.618 / 2.0 projection rendering
Dynamic Line Width: Higher similarity = thicker emphasis
Stats Panel: Visualizes similarity, ratio adoption, and processing state
🧠 Technical Architecture
This indicator is a KNN-driven Fibonacci AI that "learns from the past."
Swing Detection: pivothigh / pivotlow at swingLen, filtered by minSwingATR × ATR to eliminate noise. Swing ID tracking minimizes recomputation.
6-Dimensional Feature Vector: ①Return (f_ret) ②Volatility ratio (f_volaRatio) ③Volume ratio (f_volRatio) ④EMA slope (f_slope) ⑤Range position (f_rangePos) ⑥Normalized RSI (f_rsi) — vectorizes current market state.
Cosine Similarity: Computes similarity between the current vector and each historical state vector, quantifying regime resemblance on a -1 to 1 scale.
KNN Search: Scans historyBars range with sampleStep intervals, extracts top-K (knnK) similar states. similarityMin threshold filters out low-quality matches.
Level Harvesting: Reverse-engineers reactive price levels from analogous regimes, matches them against candidateRatios (18 ratios from 0.146 to 2.618), and accumulates them into adaptiveRatios.
Weighted Voting: Each ratio is quality-scored via similarity-weighted voting.
Breakout Probability: Calculated from price behavior (break vs. respect) around each level over probLookback bars.
Hybrid Mode: Combines standard Fibs with adaptive Fibs to harness both worlds.
⚙️ Recommended Settings & Tuning Guide
Crypto Defaults:
BTC (4H): swingLen=10, knnK=8, historyBars=2000, similarityMin=0.55
ETH (1H): swingLen=8, knnK=10, historyBars=1500, similarityMin=0.50
SOL/XRP (15M): swingLen=6, knnK=12, historyBars=1200, similarityMin=0.45
Long-Term (1D): swingLen=15, knnK=6, historyBars=3000, similarityMin=0.60
Tuning Guide:
Precision: similarityMin=0.70, knnK=5 for ultra-selective matching
Maximum learning: historyBars=4000, sampleStep=2 to maximize data
Speed priority: sampleStep=5, featureLen=15 to reduce load
Trending markets: includeExt=true, showBeyond=true for projection emphasis
Range markets: adaptMode=Adaptive to prioritize learned ratios
Beginners: adaptMode=Hybrid offers the safest standard + AI dual view
💡 How to Use in Practice
High-Probability Bounce: colLowProb (green) levels are strong S/R — bounce entry candidates
Breakout Plays: colHighProb (red) levels signal high break expectation — follow-through trades
Adaptive Edge: Non-standard ratios (0.65, 0.707, etc.) appearing in Adaptive mode are regime-specific key levels
Extension Targets: Use 1.272 / 1.618 / 2.0 projections for take-profit
Multi-Timeframe: Higher TF adaptive Fibs + lower TF entry refinement
AetherEdge Synergy: When Neural OB Evolution elite OBs overlap an adaptive Fib → confluence powerhouse zone
⚠️ Important Notes
The first several hundred bars lack training data, so Adaptive mode may not function well early on
Increasing historyBars improves accuracy but raises computational load (trade-off)
Effectiveness drops during sudden regime shifts that have no historical analog
Levels are not drawn until swings confirm (swingLen bars later)
KNN processing executes on bar close — real-time reflection occurs on the next bar
Excessively large featureLen risks over-referencing outdated patterns
🚨 Disclaimer
This indicator is provided for educational and research purposes only and does not constitute financial advice. KNN similarity and probability 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.
AetherEdge Adaptive Fibonacci AI is a machine-learning-driven adaptive Fibonacci engine that completely transcends traditional static ratios. A KNN (K-Nearest Neighbors) algorithm extracts the most similar historical regimes from up to 2,000 prior bars and learns which golden ratios actually worked in those analogous conditions. It then probabilistically computes a breakout probability for each level — a revolutionary tool that visualizes "which Fib will hold" as a forward-looking forecast.
🔶 Key Features
Dynamic Swing Detection: ATR-based filtering of meaningful swings only
KNN Similarity Engine: 6-dimensional feature × cosine similarity matching
Adaptive Fibonacci: Learns ratios that worked in similar regimes
3 Modes: Standard (fixed) / Adaptive (learned) / Hybrid (fused)
Breakout Probability Forecast: % probability displayed per level
3-Tier Color Coding: High / Mid / Low breakout probability
Predicted Extension Lines: 1.272 / 1.618 / 2.0 projection rendering
Dynamic Line Width: Higher similarity = thicker emphasis
Stats Panel: Visualizes similarity, ratio adoption, and processing state
🧠 Technical Architecture
This indicator is a KNN-driven Fibonacci AI that "learns from the past."
Swing Detection: pivothigh / pivotlow at swingLen, filtered by minSwingATR × ATR to eliminate noise. Swing ID tracking minimizes recomputation.
6-Dimensional Feature Vector: ①Return (f_ret) ②Volatility ratio (f_volaRatio) ③Volume ratio (f_volRatio) ④EMA slope (f_slope) ⑤Range position (f_rangePos) ⑥Normalized RSI (f_rsi) — vectorizes current market state.
Cosine Similarity: Computes similarity between the current vector and each historical state vector, quantifying regime resemblance on a -1 to 1 scale.
KNN Search: Scans historyBars range with sampleStep intervals, extracts top-K (knnK) similar states. similarityMin threshold filters out low-quality matches.
Level Harvesting: Reverse-engineers reactive price levels from analogous regimes, matches them against candidateRatios (18 ratios from 0.146 to 2.618), and accumulates them into adaptiveRatios.
Weighted Voting: Each ratio is quality-scored via similarity-weighted voting.
Breakout Probability: Calculated from price behavior (break vs. respect) around each level over probLookback bars.
Hybrid Mode: Combines standard Fibs with adaptive Fibs to harness both worlds.
⚙️ Recommended Settings & Tuning Guide
Crypto Defaults:
BTC (4H): swingLen=10, knnK=8, historyBars=2000, similarityMin=0.55
ETH (1H): swingLen=8, knnK=10, historyBars=1500, similarityMin=0.50
SOL/XRP (15M): swingLen=6, knnK=12, historyBars=1200, similarityMin=0.45
Long-Term (1D): swingLen=15, knnK=6, historyBars=3000, similarityMin=0.60
Tuning Guide:
Precision: similarityMin=0.70, knnK=5 for ultra-selective matching
Maximum learning: historyBars=4000, sampleStep=2 to maximize data
Speed priority: sampleStep=5, featureLen=15 to reduce load
Trending markets: includeExt=true, showBeyond=true for projection emphasis
Range markets: adaptMode=Adaptive to prioritize learned ratios
Beginners: adaptMode=Hybrid offers the safest standard + AI dual view
💡 How to Use in Practice
High-Probability Bounce: colLowProb (green) levels are strong S/R — bounce entry candidates
Breakout Plays: colHighProb (red) levels signal high break expectation — follow-through trades
Adaptive Edge: Non-standard ratios (0.65, 0.707, etc.) appearing in Adaptive mode are regime-specific key levels
Extension Targets: Use 1.272 / 1.618 / 2.0 projections for take-profit
Multi-Timeframe: Higher TF adaptive Fibs + lower TF entry refinement
AetherEdge Synergy: When Neural OB Evolution elite OBs overlap an adaptive Fib → confluence powerhouse zone
⚠️ Important Notes
The first several hundred bars lack training data, so Adaptive mode may not function well early on
Increasing historyBars improves accuracy but raises computational load (trade-off)
Effectiveness drops during sudden regime shifts that have no historical analog
Levels are not drawn until swings confirm (swingLen bars later)
KNN processing executes on bar close — real-time reflection occurs on the next bar
Excessively large featureLen risks over-referencing outdated patterns
🚨 Disclaimer
This indicator is provided for educational and research purposes only and does not constitute financial advice. KNN similarity and probability 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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
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.