OPEN-SOURCE SCRIPT
Kernel Regression Trend Line

KTrend – Non-Repainting Kernel Regression Trend (2025 Clean Version)
Ultra-clean, powerful, and completely non-repainting trend-following tool based on advanced Kernel regression (Rational Quadratic + Gaussian blend).
How it works:
• Uses two different kernel estimates with smart lag to detect genuine trend reversals
• Plots a thick, beautifully colored trend line (teal when rising, deep red when falling)
• Places precise, locked-in Bullish Flip (green triangle below bar) and Bearish Flip (red triangle above bar) signals only on confirmed bar close – zero repaint, ever
• Optional smoothing mode for even cleaner visuals
Features
✓ 100% non-repainting signals and line
✓ Minimal lag while staying extremely responsive
✓ Clean aesthetic – perfect for BTC, ETH, stocks, forex, any timeframe
✓ Built-in alerts for Bullish & Bearish flips
✓ Fully open source (MPL 2.0)
Default settings are already battle-tested and loved by thousands:
- Lookback Window: 11
- Relative Weighting: 8.0
- Regression Level: 25
- Lag: 2
Great on 1H–Daily charts, especially crypto and indices.
Credits: Original kernel library by jdehorty, cleaned & enhanced flip logic by HighlanderOne.
Enjoy the smoothest, most reliable kernel trend tool on TradingView – completely free!
Ultra-clean, powerful, and completely non-repainting trend-following tool based on advanced Kernel regression (Rational Quadratic + Gaussian blend).
How it works:
• Uses two different kernel estimates with smart lag to detect genuine trend reversals
• Plots a thick, beautifully colored trend line (teal when rising, deep red when falling)
• Places precise, locked-in Bullish Flip (green triangle below bar) and Bearish Flip (red triangle above bar) signals only on confirmed bar close – zero repaint, ever
• Optional smoothing mode for even cleaner visuals
Features
✓ 100% non-repainting signals and line
✓ Minimal lag while staying extremely responsive
✓ Clean aesthetic – perfect for BTC, ETH, stocks, forex, any timeframe
✓ Built-in alerts for Bullish & Bearish flips
✓ Fully open source (MPL 2.0)
Default settings are already battle-tested and loved by thousands:
- Lookback Window: 11
- Relative Weighting: 8.0
- Regression Level: 25
- Lag: 2
Great on 1H–Daily charts, especially crypto and indices.
Credits: Original kernel library by jdehorty, cleaned & enhanced flip logic by HighlanderOne.
Enjoy the smoothest, most reliable kernel trend tool on TradingView – completely free!
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
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
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
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.