TradingView
yosietserga
14 апр 2024 г., 23:09

Nadaraya-Watson Probability [Yosiet] 

EUR/USDOANDA

Описание

The script calculates and displays probability bands around price movements, offering insights into potential market trends.

Setting Up the Script
  • Window Size: Determines the length of the window for the Nadaraya-Watson estimation. A larger window smooths the data more but might lag current market conditions.
  • Bandwidth: Controls the bandwidth for the kernel regression, affecting the smoothness of the probability bands.


Reading the Data Table
The script dynamically updates a table positioned at the bottom right of your chart, providing real-time insights into market probabilities. Here's how to interpret the table:

Table Columns: The table is organized into three columns:
Up: Indicates the probability or relative change percentage for the upper band.
Down: Indicates the probability or relative change percentage for the lower band.

Table Rows: There are two main rows of interest:
P%: Shows the price change percentage difference between the bands and the closing price. A positive value in the "Up" column suggests the upper band is above the current close, indicating potential upward momentum. Conversely, a negative value in the "Down" column suggests downward momentum.
R%: Displays the relative inner change percentage difference between the bands, offering a measure of the market's volatility or stability within the bands.

Utilizing the Insights
Market Trends: A widening gap between the "Up" and "Down" percentages in the "P%" row might indicate increasing market volatility. Traders can use this information to adjust their risk management strategies accordingly.
Entry and Exit Points: The "R%" row provides insights into the relative position of the current price within the probability bands. Traders might consider positions closer to the lower band as potential entry points and positions near the upper band as exit points or take-profit levels.

Conclusion
The Nadaraya-Watson Probability script offers a sophisticated tool for traders looking to incorporate statistical analysis into their trading strategy. By understanding and utilizing the data presented in the script's table, traders can gain insights into market trends and volatility, aiding in decision-making processes. Remember, no indicator is foolproof; always consider multiple data sources and analyses when making trading decisions.
Комментарии
stryker251
Outstanding! Could you add the option of showing the envelop too? Thank you!!
stryker251
@stryker251, Lastly, is it possible to add a third row showing the percentage distance the closing price is from the upper and down of the envelope? For example, D% up is 92% away from the closing price and down is 8% away from the closing price. Many thanks.
yosietserga
@stryker251, Hi! thank you for your support and donation. The value of P% is the distance of the closing price from the bands, you can use that percent to calculate directly your risk and size positions, and for the envelope check my other script: tradingview.com/script/DoOd6evK-Nadaraya-Watson-Envelope-Modified-by-Yosiet/
yosietserga
@stryker251, i hope that can place your requirements
stryker251
I just added the second indicator to show the bands and had some coffee. Should line 50 [cross_up, cross_dn] = nwe(low, high) be [cross_up, cross_dn] = nwe(high, low)?
yosietserga
@stryker251, the source for the upper band is the low price and the source for the lower band is high price
stryker251
@yosietserga, thank you
yosietserga
@stryker251, you can change the default params if you want, but the bands are calculated to predict the price manipulations and give a consistent band for non-volatile markets seasons
stryker251
@yosietserga, Last question :-) What code would I use to get the previous candle's upper and lower band value in a variable? I have an idea but don't really know Pine to get it for a formula.
B-AWACS
Bravo.Thank you!!
Ещё