Triple Confirmation Kernel Regression Overlay [QuantraAI]

QuantraSystems Mis à jour   
Kernel Regression Oscillator - Overlay


The Kernel Regression Oscillator (ᏦᏒᎧ) represents an advanced tool for traders looking to capitalize on market trends.
This Indicator is valuable in identifying and confirming trend directions, as well as probabilistic and dynamic oversold and overbought zones.

It achieves this through a unique composite approach using three distinct Kernel Regressions combined in an Oscillator.
The additional Chart Overlay Indicator adds confidence to the signal.
Which is this Indicator.

This methodology helps the trader to significantly reduce false signals and offers a more reliable indication of market movements than more widely used indicators can.


The upper section is the Overlay. It features the Signal Wave to display the current trend.
Its Overbought and Oversold zones start at 50% and end at 100% of the selected Standard Deviation (default σ = 3), which can indicate extremely rare situations which can lead to either a softening momentum in the trend or even a mean reversion situation.

The lower one is the Base Chart.
The Indicator is linked here

It features the Kernel Regression Oscillator to display a composite of three distinct regressions, also displaying current trend.
Its Overbought and Oversold zones start at 50% and end at 100% of the selected Standard Deviation (default σ = 2), which can indicate extremely rare situations.

Case Study

To effectively utilize the ᏦᏒᎧ, traders should use both the additional Overlay and the Base
Chart at the same time. Then focus on capturing the confluence in signals, for example:

If the 𝓢𝓲𝓰𝓷𝓪𝓵 𝓦𝓪𝓿𝓮 on the Overlay and the ᏦᏒᎧ on the Base Chart both reside near the extreme of an Oversold zone the probability is higher than normal that momentum in trend may soften or the token may even experience a reversion soon.

If a bar is characterized by an Oversold Shading in both the Overlay and the Base Chart, then the probability is very high to experience a reversion soon.
In this case the trader may want to look for appropriate entries into a long position, as displayed here.

If a bar is characterized by an Overbought Shading in either Overlay or Base Chart, then the probability is high for momentum weakening or a mean reversion.
In this case the trade may have taken profit and closed his long position, as displayed here.

Please note that we always advise to find more confluence by additional indicators.

Recommended Settings

Swing Trading (1D chart)

Bandwith: 45
Width: 2
SD Lookback: 150
SD Multiplier: 2
Base Chart
Bandwith: 45
SD Lookback: 150
SD Multiplier: 2

Fast-paced, Scalping (4min chart)

Bandwith: 75
Width: 2
SD Lookback: 150
SD Multiplier: 3
Base Chart
Bandwith: 45
SD Lookback: 150
SD Multiplier: 2


  • The Kernel Regression Oscillator on the Base Chart is also sensitive to divergences if that is something you are keen on using.

  • For maximum confluence, it is recommended to use the indicator both as a chart overlay and in its Base Chart.
    Please pay attention to shaded areas with Standard Deviation settings of 2 or 3 at their outer borders, and consider action only with high confidence when both parts of the indicator align on the same signal.
  • This tool shows its best performance on timeframes lower than 4 hours.
  • Traders are encouraged to test and determine the most suitable settings for their specific trading strategies and timeframes.
  • The trend following functionality is indicated through the "𝓢𝓲𝓰𝓷𝓪𝓵 𝓦𝓪𝓿𝓮" Line, with optional "Up" and "Down" arrows to denote trend directions only (toggle “Show Trend Signals”).


The Kernel Regression Oscillator takes three distinct kernel regression functions,
used at similar weight, in order to calculate a balanced and smooth composite of the regressions. Part of it are:
  1. The Epanechnikov Kernel Regression: Known for its efficiency in smoothing data by assigning less weight to data points further away from the target point than closer data points, effectively reducing variance.
  2. The Wave Kernel Regression: Similarly assigning weight to the data points based on distance, it captures repetitive and thus wave-like patterns within the data to smoothen out and reduce the effect of underlying cyclical trends.
  3. The Logistic Kernel Regression: This uses the logistic function in order to assign weights by probability distribution on the distance between data points and target points. It thus avoids both bias and variance to a certain level.

kernel(source, bandwidth, kernel_type) =>
    switch kernel_type
        "Epanechnikov" => math.abs(source) <= 1 ? 0.75 * (1 - math.pow(source, 2)) : 0.0
        "Logistic"          => 1/math.exp(source + 2 + math.exp(-source))
        "Wave"             => math.abs(source) <= 1 ? (1 - math.abs(source)) * math.cos(math.pi * source) : 0.

kernelRegression(src, bandwidth, kernel_type) =>
    sumWeightedY = 0.
    sumKernels = 0.
    for i = 0 to bandwidth - 1
        base = i*i/math.pow(bandwidth, 2)
        kernel = kernel(base, 1, kernel_type)
        sumWeightedY += kernel * src[i]
        sumKernels   += kernel
    (src - sumWeightedY/sumKernels)/src

// Triple Confirmations
Ep = kernelRegression(source, bandwidth, 'Epanechnikov' )
Lo = kernelRegression(source, bandwidth, 'Logistic'     )
Wa = kernelRegression(source, bandwidth, 'Wave'         )

By combining these regressions in an unbiased average, we follow our principle of achieving confluence for a signal or a decision, by stacking several edges to increase the probability that we are correct.
// Average
AV    = math.avg(Ep, Lo, Wa)

The Standard Deviation bands take defined parameters from the user, in this case sigma of ideally between 2 to 3,
to help the indicator detect extremely improbable conditions and thus take an inversely probable signal from it to forward to the user.

The parameter settings and also the visualizations allow for ample customizations by the trader. The indicator comes with default and recommended settings.

For questions or recommendations, please feel free to seek contact in the comments.

Notes de version:
Improved Visualization - to prevent clashes between the bar coloring and the "Signal Wave."
Notes de version:
Added the option to remove the Standard Deviation Band's shading.
Notes de version:
Added custom alerts!
Alerts are based upon bar coloring and overbought/oversold (OB/OS) zones.
Notes de version:
Added monochrome colors and the option for user-defined color themes.
Notes de version:
Non-critical update:
Adjusted the 'Wave' kernel function to return positive weights only, ensuring more conventional kernel behavior.

source ≤ 1 changed to
source ≤ 0.5
Notes de version:
Added an internal rescaling function - ensures a non-decimal tick size.
This fixes a bug where the indicator did not display correctly on symbols with extremely low nominal prices.
Notes de version:
Added 'Dynamic' capabilities.
Notes de version:
Updated Dynamic Function Library.
Updated header name tag.

No statements or claims aim to be financial advice,
neither are any signals from us or our indicators.

Want to learn Trading, Investing or system building?
Join the Community! 👇

Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?