OPEN-SOURCE SCRIPT

UM Nadaraya-Watson Oscillator

64
Description
This is a different take on the Nadaraya-Watson Estimator from both Jdhorty and LuxAlgo. Both great scripts, I encourage everyone to check them out. Think of this script as a measure of trend direction, direction change, and trend acceleration or deceleration. It is not a Moving Average, but you could think of it as loosely as an intelligent adaptive regression curve with the focus on trend direction. The Gaussian calculations prefer and add more weight to the most recent bars. The end result is the oscillator is more responsive with less lag and less prone to pure price noise.

How it Works
The indicator was added to the chart twice; once with an MA, once without. The oscillator indicates trend change by crossing up through the zero line or down through the zero line. Once the indicator turns positive, we are in a positive trend until it crosses below zero and then the trend turns negative. I implemented a Moving Average overlay for additional signal determination; if the configured MA (EMA, SMA, WMA, or Nadaraya-Watson Estimator) trends higher, it is green. When trending down, it is red. The indicator also changes the color of the price bars; when the indicator below zero and red, the price bars are red. When the indicator is above zero and green, the price bars are green.

I marked up the chart and indicator to identify LONG, SHORT, and divergences between price and oscillator.

Default Settings
The default settings are 16 for Bandwidth and a WMA with 110. This is shown in the chart example. There directional arrows, but they are off by default. The Price bars are colored green or red to match the oscillator and the bar coloring is on by default.

All settings are user-configurable including bandwidth, MA type, MA length, bar coloring, and arrows.

Suggested Settings and uses
I personally like the 30 min chart with a bandwidth of 16 and a WMA of 110. The bandwidth 8 and 8 period EMA or WMA also work well on 6 hour and daily charts. Add this to your chart arsenal and use your favorite indicators for confirmation. This indicator works well on the 30 minute chart for inverse ETFs as well (SQQQ, SOXS, TZA). Also, the oscillator is good for identifying divergences between price and and indicator. (see chart for illustration)

Experiment with settings and adapt them to your trading style.

Alerts
If you right click the indicator, and select add alert, I have configured 4 standard alerts: A bullish cross above zero, A bearish cross below zero, An MA bullish turned up to trend higher, (green), and an MA bearish turned down to trend lower (red).


Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.