OPEN-SOURCE SCRIPT

AetherEdge KNN Momentum Whisper

851
🖊️ Overview
AetherEdge KNN Momentum Whisper is a next-generation momentum forecasting engine powered by the K-Nearest Neighbors algorithm. It builds a rolling library of up to 300 historical market patterns, instantly retrieves the K most similar precedents to the current setup, and computes a distance-weighted forecast of next-bar momentum. The result is delivered through a single, elegant histogram whose color intensity simultaneously encodes direction, magnitude, and consensus confidence.

🔶 Key Features

True KNN pattern-matching engine with rolling historical dictionary
3D feature vectors: returns, normalized RSI, ATR Z-score
Variable pattern length (3–10 bars) for tunable temporal context
Inverse-distance weighted prediction — closer matches dominate
Consensus confidence scoring measuring directional agreement among neighbors
Dynamic color intensity driven by strength × confidence
Ultra-clean single histogram visualization — direction, power, and conviction in one bar
Four smart alerts for strong signals and directional flips
🧠 Technical Architecture

1. Feature Extraction Layer (Multi-dimensional Pattern Vector)

Return: single-bar percent change
RSI Normalized: scaled to -1..+1 (×2 amplified)
ATR Z-Score: 50-bar standardized volatility
These are concatenated across patternLen bars to form vectors up to 30 dimensions.

2. Pattern Library Layer (Rolling Dictionary)
Every bar appends a (past pattern, realized future return) pair to the library. Once historySize is exceeded, oldest entries are automatically pruned — always keeping the freshest learning corpus.

3. KNN Search Layer
Computes Euclidean distances from the current pattern to every library entry, then performs selection-based extraction of the K nearest neighbors. Their future-return labels are blended via 1/(d+ε) weighting to produce the momentum forecast.

4. Confidence Scoring Layer
Counts how many of the K neighbors agree on direction (bullish vs bearish). The dominant ratio becomes the confidence score (0–1).

5. Dynamic Visualization Layer
The forecast is ATR-normalized; strength = |normalized forecast| × confidence. Transparency is interpolated between minAlpha and maxAlpha — strong signals appear bold, weak signals fade.

⚙️ Recommended Settings & Tuning Guide

Crypto Defaults

BTC (1H–4H): History 300, K=8, Pattern 5, Forecast 1
ETH (30m–2H): History 300, K=8, Pattern 5, Forecast 1
SOL (15m–1H): History 250, K=10, Pattern 4, Forecast 1
XRP (1H–4H): History 350, K=8, Pattern 6, Forecast 2
Parameter Tuning

History Size: larger = more statistical stability (300 is the sweet spot)
K (Neighbors): 3–5 = reactive, 10–15 = stable
Pattern Length: 3–4 for short-term reversals, 6–8 for trend continuation
Forecast Horizon: 1–2 highest accuracy; 3+ adds noise
Features: Return + ATR for trends, prioritize RSI in ranges
💡 How to Use in Practice

Scenario 1 — Bold-Bar Entries
Vivid (low-transparency) bars indicate high strength × high confidence — historical neighbors overwhelmingly agree. Premium signals for trend-following entries.

Scenario 2 — Histogram Flip Detection
Zero-line crossover is the earliest "whisper" of momentum reversal. Use it as exit signal in trend-following or entry in mean-reversion strategies.

Scenario 3 — Faded Bars = Caution
Highly transparent bars indicate disagreement among neighbors — the market is in unfamiliar territory. Stand aside.

Multi-Timeframe Workflow
Confirm macro direction on 4H KNN → identify setup on 1H → time entries on 15m. Pairs powerfully with S/R and regime-detection tools.

⚠️ Important Notes

Forecasts activate only after historySize + patternLen bars are accumulated
Pattern library resets on chart reload
Computationally heavy — reduce historySize to 200 on low-spec setups
Sudden regime shifts may render past patterns less informative
🚨 Disclaimer
This indicator is provided for educational and analytical purposes only and does not constitute financial advice. All trading decisions remain your sole responsibility. Past performance does not guarantee future results, and crypto markets carry substantial risk.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.