OPEN-SOURCE SCRIPT

Relational Quadratic Kernel Channel [Vin]

Mis à jour
The Relational Quadratic Kernel Channel (RQK-Channel-V) is designed to provide more valuable potential price extremes or continuation points in the price trend.

Example:
snapshot

Usage:
  1. Lookback Window: Adjust the "Lookback Window" parameter to control the number of previous bars considered when calculating the Rational Quadratic Estimate. Longer windows capture longer-term trends, while shorter windows respond more quickly to price changes.
  2. Relative Weight: The "Relative Weight" parameter allows you to control the importance of each data point in the calculation. Higher values emphasize recent data, while lower values give more weight to historical data.
  3. Source: Choose the data source (e.g., close price) that you want to use for the kernel estimate.
  4. ATR Length: Set the length of the Average True Range (ATR) used for channel width calculation. A longer ATR length results in wider channels, while a shorter length leads to narrower channels.
  5. Channel Multipliers: Adjust the "Channel Multiplier" parameters to control the width of the channels. Higher multipliers result in wider channels, while lower multipliers produce narrower channels. The indicator provides three sets of channels, each with its own multiplier for flexibility.



Details:
Rational Quadratic Kernel Function:
The Rational Quadratic Kernel Function is a type of smoothing function used to estimate a continuous curve or line from discrete data points. It is often used in time series analysis to reduce noise and emphasize trends or patterns in the data.
The formula for the Rational Quadratic Kernel Function is generally defined as:

Where:
  • x represents the distance or difference between data points.
  • α and β are parameters that control the shape of the kernel. These parameters can be adjusted to control the smoothness or flexibility of the kernel function.


In the context of this indicator, the Rational Quadratic Kernel Function is applied to a specified source (e.g., close prices) over a defined lookback window. It calculates a smoothed estimate of the source data, which is then used to determine the central value of the channels. The kernel function allows the indicator to adapt to different market conditions and reduce noise in the data.

The specific parameters (length and relativeWeight) in your indicator allows to fine-tune how the Rational Quadratic Kernel Function is applied, providing flexibility in capturing both short-term and long-term trends in the data.
To know more about unsupervised ML implementations, I highly recommend to follow the users, jdehorty and LuxAlgo


Optimizing the parameters:
Lookback Window (length): The lookback window determines how many previous bars are considered when calculating the kernel estimate.
  • For shorter-term trading strategies, you may want to use a shorter lookback window (e.g., 5-10).
  • For longer-term trading or investing, consider a longer lookback window (e.g., 20-50).


Relative Weight (relativeWeight): This parameter controls the importance of each data point in the calculation.
  • A higher relative weight (e.g., 2 or 3) emphasizes recent data, which can be suitable for trend-following strategies.
  • A lower relative weight (e.g., 1) gives more equal importance to historical and recent data, which may be useful for strategies that aim to capture both short-term and long-term trends.


ATR Length (atrLength): The length of the Average True Range (ATR) affects the width of the channels.
  • Longer ATR lengths result in wider channels, which may be suitable for capturing broader price movements.
  • Shorter ATR lengths result in narrower channels, which can be helpful for identifying smaller price swings.


Channel Multipliers (channelMultiplier1, channelMultiplier2, channelMultiplier3): These parameters determine the width of the channels relative to the ATR.
  • Adjust these multipliers based on your risk tolerance and desired channel width.
  • Higher multipliers result in wider channels, which may lead to fewer signals but potentially larger price movements.
  • Lower multipliers create narrower channels, which can result in more frequent signals but potentially smaller price movements.
Notes de version
v2
Change Log:
  1. Added fourth set of channels. Set to hide by default.
  2. Added Alert Signals when price reaches the 4th set of channel.
  3. Added Buy signal for notifying potential uptrend.
  4. Added Sell signal for notifying potential downtrend.
  5. Changed default lookback Window to 42, based on various back testing studies.
  6. Changed default Relative Weight to 25, based on various back testing studies.
  7. Changed default Source to ohlc4, based on various back testing studies.
  8. Changed default ATR Length to 40, based on various back testing studies.
  9. Changed default value of Channel Multiplier (First Set) to 1.5, based on various back testing studies.
  10. Changed default value of Channel Multiplier (Second Set) to 5, based on various back testing studies.
  11. Changed default value of Channel Multiplier (Third Set) to 6, based on various back testing studies.



Usage of new features:

snapshot

Alert Signal:
Orange circle represents the "Alert Signals", denoting price may have reached the oversold or overbought zones.

Buy Signal:
  • Green upward triangle represents the Buy signal.
  • First or second Buy signal after alert signal (appeared at 4 lower channels) has more weightage and possibilities of strong uptrend.


Sell Signal:
  • Red downward triangle represents the Sell signal.
  • First or second sell signals appearing after the alert signal has more weightage and possibilities of strong downtrend.
Bands and Channelskernelmachine-learningmean-reversionmlregressionregressionsrelational-quadratic-kernel-channelssignalsTrend AnalysisVIN

Script open-source

Dans le plus pur esprit 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 nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité