OPEN-SOURCE SCRIPT

RBF Kijun Trend System [InvestorUnknown]

The RBF Kijun Trend System utilizes advanced mathematical techniques, including the Radial Basis Function (RBF) kernel and Kijun-Sen calculations, to provide traders with a smoother trend-following experience and reduce the impact of noise in price data. This indicator also incorporates ATR to dynamically adjust smoothing and further minimize false signals.

Radial Basis Function (RBF) Kernel Smoothing
  • The RBF kernel is a mathematical method used to smooth the price series. By calculating weights based on the distance between data points, the RBF kernel ensures smoother transitions and a more refined representation of the price trend.
  • The RBF Kernel Weighted Moving Average is computed using the formula:




  • The smoothed price is then calculated as a weighted sum of past prices, using the RBF kernel weights:




Kijun-Sen Calculation
  • The Kijun-Sen, a component of Ichimoku analysis, is used here to further establish trends. The Kijun-Sen is computed as the average of the highest high and the lowest low over a specified period (default: 14 periods).
  • This Kijun-Sen calculation is based on the RBF-smoothed price to ensure smoother and more accurate trend detection.




ATR-Adjusted RBF and Kijun-Sen
  • To mitigate false signals caused by price volatility, the indicator features ATR-adjusted versions of both the RBF smoothed price and Kijun-Sen.
  • The ATR multiplier is used to create upper and lower bounds around these lines, providing dynamic thresholds that account for market volatility.


Neutral State and Trend Continuation
  • This indicator can interpret a neutral state, where the signal is neither bullish nor bearish. By default, the indicator is set to interpret a neutral state as a continuation of the previous trend, though this can be adjusted to treat it as a truly neutral state.
  • Users can configure this setting using the signal_str input:




snapshot
Visual difference between "Neutral" (Bottom) and "Continuation of Previous Trend" (Top). Click on the picture to see it in full size.

Customizable Inputs and Settings:
  • Source Selection: Choose the input source for calculations (open, high, low, close, etc.).
  • Kernel Length and Sigma: Adjust the RBF kernel parameters to change the smoothing effect.
  • Kijun Length: Customize the lookback period for Kijun-Sen.
  • ATR Length and Multiplier: Modify these settings to adapt to market volatility.


Backtesting and Performance Metrics
The indicator includes a Backtest Mode, allowing users to evaluate the performance of the strategy using historical data. In Backtest Mode, a performance metrics table is generated, comparing the strategy's results to a simple buy-and-hold approach. Key metrics include mean returns, standard deviation, Sharpe ratio, and more.
  • Equity Calculation: The indicator calculates equity performance based on signals, comparing it against the buy-and-hold strategy.
  • Performance Metrics Table: Detailed performance analysis, including probabilities of positive, neutral, and negative returns.


Alerts
To keep traders informed, the indicator supports alerts for significant trend shifts:



Important Notes
  • Calibration Needed: The default settings provided are not optimized and are intended for demonstration purposes only. Traders should adjust parameters to fit their trading style and market conditions.
  • Neutral State Interpretation: Users should carefully choose whether to treat the neutral state as a continuation or a separate signal.
  • Backtest Results: Historical performance is not indicative of future results. Market conditions change, and past trends may not recur.
Moving AveragesstatisticsTrend Analysis

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal