- 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.
- 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.
- Source: Choose the data source (e.g., close price) that you want to use for the kernel estimate.
- 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.
- 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.
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:
K(x) = (1 + (x^2) / (2 * α * β))^(-α)
- 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.
- Added fourth set of channels. Set to hide by default.
- Added Alert Signals when price reaches the 4th set of channel.
- Added Buy signal for notifying potential uptrend.
- Added Sell signal for notifying potential downtrend.
- Changed default lookback Window to 42, based on various back testing studies.
- Changed default Relative Weight to 25, based on various back testing studies.
- Changed default Source to ohlc4, based on various back testing studies.
- Changed default ATR Length to 40, based on various back testing studies.
- Changed default value of Channel Multiplier (First Set) to 1.5, based on various back testing studies.
- Changed default value of Channel Multiplier (Second Set) to 5, based on various back testing studies.
- Changed default value of Channel Multiplier (Third Set) to 6, based on various back testing studies.
Usage of new features:
Orange circle represents the "Alert Signals", denoting price may have reached the oversold or overbought zones.
- 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.
- 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.
Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.