Overview

NW Quadratic Signal is a kernel regression overlay that smooths price (or any chosen source) to reveal directional bias and cleaner turning points. It plots a color-changing Kernel line and can generate LONG/SHORT signals based on kernel trend shifts, price crossing the kernel, or a combined confirmation approach.

How It Works

The indicator estimates a smoothed value (yhat) using a Nadaraya–Watson style kernel regression with a rational-quadratic weighting curve. Recent bars receive higher influence, while older bars are progressively down-weighted based on your settings.

  • Trend state: Bullish when the kernel is rising; bearish when it is falling (derived from the kernel slope).
  • Trend change: A bullish change triggers when the kernel turns up after previously pointing down (and vice versa for bearish).
  • Price cross: Bullish when price crosses above the kernel; bearish when price crosses below.

Signal Modes

You can control how signals are produced using Signal Mode:

  • Trend Change Only: Signals fire on kernel direction flips.
  • Price Cross Only: Signals fire when the close crosses the kernel.
  • Trend Change + Price Cross: Requires a kernel flip plus price being on the correct side of the kernel (bullish above / bearish below).

Slope Filter (Noise Control)

To reduce signals in sideways markets, the script includes a slope threshold based on the kernel’s movement relative to price:

  • Min Slope (%): Uses |yhat − yhat[1]| / close * 100. Set to 0 to disable filtering.

What You’ll See on the Chart

  • Kernel line (overlay): Lime when bullish, fuchsia when bearish.
  • Signal labels (optional): “LONG” below bars and “SHORT” above bars.

Indicator Information

Version 1.0
Category Momentum & Trend, Trend Following
Compatibility TradingView
Script Pine Script v5