kNN Trend Classifier (RSI, CCI, W%R, ADX, EMA)

At its core, the indicator utilizes six key features: RSI (14), RSI (9), CCI, Williams %R, ADX, and 9-period EMA. Each of these measures different dimensions of momentum, trend strength, and market positioning. These values are normalized to ensure they are fairly compared across different market conditions. For every bar close, the script stores a historical snapshot of these features and uses a k-Nearest Neighbor (kNN) technique to classify the current trend as bullish or bearish. The kNN algorithm works by calculating the Euclidean distance between the present market state and all stored historical states, then referencing the majority label among the closest neighbors to decide on the market regime.
The script also provides powerful customization. Users can adjust the number of neighbors (k) to make signals more reactive or more stable; increase the training window for a deeper historical perspective; and fine-tune the lookback window for feature normalization. Two optional filters—based on volume percentile and ATR volatility—help to screen out signals in low-liquidity or low-volatility periods, reducing false positives and improving reliability.
To modify the behavior, traders should experiment with the inputs: lower k for faster signal changes, raise k or the training window for smoother signals, and adjust normalization length for different levels of trend sensitivity. Activating the volume and volatility filters is highly recommended during choppy markets. Altogether, this script gives users a robust framework to catch bullish or bearish trends with a blend of proven technical analysis and adaptive pattern recognition.
Skrypt tylko na zaproszenie
Tylko użytkownicy zatwierdzeni przez autora mogą uzyskać dostęp do tego skryptu. Musisz złożyć prośbę i uzyskać zgodę na jego użycie. Zazwyczaj jest ona udzielana po dokonaniu płatności. Aby uzyskać więcej informacji, postępuj zgodnie z instrukcjami autora poniżej lub skontaktuj się bezpośrednio z jaydesaigu.
TradingView NIE zaleca płacenia za skrypt ani jego używania, jeśli nie masz pełnego zaufania do jego autora i nie rozumiesz, jak działa. Możesz także znaleźć darmowe, open-source'owe alternatywy w naszej sekcji skryptów społecznościowych.
Instrukcje autora
Wyłączenie odpowiedzialności
Skrypt tylko na zaproszenie
Tylko użytkownicy zatwierdzeni przez autora mogą uzyskać dostęp do tego skryptu. Musisz złożyć prośbę i uzyskać zgodę na jego użycie. Zazwyczaj jest ona udzielana po dokonaniu płatności. Aby uzyskać więcej informacji, postępuj zgodnie z instrukcjami autora poniżej lub skontaktuj się bezpośrednio z jaydesaigu.
TradingView NIE zaleca płacenia za skrypt ani jego używania, jeśli nie masz pełnego zaufania do jego autora i nie rozumiesz, jak działa. Możesz także znaleźć darmowe, open-source'owe alternatywy w naszej sekcji skryptów społecznościowych.