Nadaraya-Watson Smoothers [LuxAlgo]

LuxAlgo Wizard Обновлено   
The following tool smoothes the price data using various methods derived from the Nadaraya-Watson estimator, a simple Kernel regression method. This method makes use of the Gaussian kernel as a weighting function.

Users have the option to use a non-repainting as well as a repainting method, see the USAGE section for more information.


🔹 Non Repainting

When Repainting Smoothing is disabled the returned indicator acts similarly to a regular causal moving average. This result could be described as an "endpoint Nadaraya-Watson estimator".

Unlike a regular moving average whose degree of smoothness is commonly determined by the length of its calculation window, the degree of smoothness of the proposed indicator is determined by the bandwidth setting, with a higher value returning smoother results.

In the above chart, a bandwidth value of 50 is used. An increasing value of the smoother is indicative of an uptrend, while a decreasing value is indicative of a downtrend.

🔹 Repainting

Non-causal smoothing methods have found low support from technical analysts because they tend to repaint. Yet, they can provide powerful insights such as estimating underlying trends in the price as well as seeing how far prices deviate from them. They can also make drawing certain patterns easier and can help see underlying structures in the price more clearly.

Using higher bandwidth values allows for estimating longer-term trends in the price.

Triangular labels highlight points where the direction of the estimator change. This allows for the identification of tops and bottoms in the underlying trend which can be compared to the actual price tops and bottoms.

Note that multiple labels can appear in real time, highlighting real-time changes in the estimator's direction. The most recent label on a series of labels is the first to appear. This can eventually be useful for the real-time predictive application of the estimator. However, it is not a usage we particularly recommend.


The Nadaraya-Watson estimator can be described as a series of weighted averages using a specific normalized kernel as a weighting function. For each point of the estimator at time t, the peak of the kernel is located at time t, as such the highest weights are attributed to values neighboring the price located at time t.

A lower bandwidth value would contribute toward a more important weighting of the price at a precise point and would as such less smooth results. In the case where our bandwidth is so small that the resulting kernel is just an impulse, we would get the raw price back.

However, when the bandwidth is sufficiently large, prices would be weighted similarly, thus resulting in a result closer to the price mean.

It can be interesting to note that due to the nature of the estimator and its weighting procedure, real-time results would not deviate drastically for points in the estimator near the center of the calculation window.


  • Bandwidth : controls the bandwidth of the Gaussian kernel, with higher values returning smoother results.
  • Src : Input source of the kernel regression.
  • Repainting Smoothing : Determine if the smoothing method should repaint or not. If disabled the "endpoint Nadaraya-Watson estimator" is returned.
Информация о релизе:
Minor changes
Информация о релизе:
Added a disclaimer which displays a small message on the chart. You can hide this from within the settings menu by checking the "Hide Disclaimer" option.
Информация о релизе:
Minor changes.
Информация о релизе:
This update allows users of the Nadaraya-Watson Estimator (Smoothers) to now have a collection of smoothing methods and non-repainting functionality if enabled within the settings.

To update to the latest version, please refresh TradingView & then remove/re-add the Nadaraya Watson indicator to your chart.

Get access to our exclusive tools:

Join our 150k+ community:

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?