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.
Script sur invitation seulement
Seuls les utilisateurs approuvés par l'auteur peuvent accéder à ce script. Vous devrez demander et obtenir l'autorisation pour l'utiliser. Celle-ci est généralement accordée après paiement. Pour plus de détails, suivez les instructions de l'auteur ci-dessous ou contactez directement jaydesaigu.
TradingView ne recommande PAS de payer ou d'utiliser un script à moins que vous ne fassiez entièrement confiance à son auteur et que vous compreniez comment il fonctionne. Vous pouvez également trouver des alternatives gratuites et open-source dans nos scripts communautaires.
Instructions de l'auteur
Clause de non-responsabilité
Script sur invitation seulement
Seuls les utilisateurs approuvés par l'auteur peuvent accéder à ce script. Vous devrez demander et obtenir l'autorisation pour l'utiliser. Celle-ci est généralement accordée après paiement. Pour plus de détails, suivez les instructions de l'auteur ci-dessous ou contactez directement jaydesaigu.
TradingView ne recommande PAS de payer ou d'utiliser un script à moins que vous ne fassiez entièrement confiance à son auteur et que vous compreniez comment il fonctionne. Vous pouvez également trouver des alternatives gratuites et open-source dans nos scripts communautaires.