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!
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
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.