OPEN-SOURCE SCRIPT

RSI Weighted Trend System I [InvestorUnknown]

Обновлено
The RSI Weighted Trend System I is an experimental indicator designed to combine both slow-moving trend indicators for stable trend identification and fast-moving indicators to capture potential major turning points in the market. The novelty of this system lies in the dynamic weighting mechanism, where fast indicators receive weight based on the current Relative Strength Index (RSI) value, thus providing a flexible tool for traders seeking to adapt their strategies to varying market conditions.

Dynamic RSI-Based Weighting System
  • The core of the indicator is the dynamic weighting of fast indicators based on the value of the RSI. In essence, the higher the absolute value of the RSI (whether positive or negative), the higher the weight assigned to the fast indicators. This enables the system to capture rapid price movements around potential turning points.


Users can choose between a threshold-based or continuous weight system:
  • Threshold-Based Weighting: Fast indicators are activated only when the absolute RSI value exceeds a user-defined threshold. Below this threshold, fast indicators receive no weight.
  • Continuous Weighting: By setting the weight threshold to zero, the fast indicators always receive some weight, although this can result in more false signals in ranging markets.




снимок


Slow and Fast Indicators
Slow Indicators are designed to identify stable trends, remaining constant in weight. These include:
  • DMI (Directional Movement Index) For Loop
  • CCI (Commodity Channel Index) For Loop
  • Aroon For Loop

Fast Indicators are more responsive and designed to spot rapid trend shifts:
  • ZLEMA (Zero-Lag Exponential Moving Average) For Loop
  • IIRF (Infinite Impulse Response Filter) For Loop


Each of these indicators is calculated using a for-loop method to generate a moving average, which captures the trend of a given length range.


RSI Normalization
  • To facilitate the weighting system, the RSI is normalized from its usual 0-100 range to a -1 to 1 range. This allows for easy scaling when calculating weights and helps the system adjust to rapidly changing market conditions.




Signal Calculation
  • The final trading signal is a weighted average of both the slow and fast indicators, depending on the calculated weights from the RSI. This ensures a balanced approach, where slow indicators maintain overall trend guidance, while fast indicators provide timely entries and exits.





Backtest Mode and Performance Metrics
This version of the RSI Weighted Trend System includes a comprehensive backtesting mode, allowing users to evaluate the performance of their selected settings against a Buy & Hold strategy. The backtesting includes:
  • Equity calculation based on the signals generated by the indicator.
  • Performance metrics table comparing Buy & Hold strategy metrics with the system’s signals, including: Mean, positive, and negative return percentages, Standard deviations (of all, positive and negative returns), Sharpe Ratio, Sortino Ratio, and Omega Ratio




The metrics help traders assess the effectiveness of their strategy over time and can be used to optimize their settings.

снимок


Calibration Mode
  • A calibration mode is included to assist users in tuning the indicator to their specific needs. In this mode, traders can focus on a specific indicator (e.g., DMI, CCI, Aroon, ZLEMA, IIRF, or RSI) and fine-tune it without interference from other signals.
  • The calibration plot visualizes the chosen indicator's performance against a zero line, making it easy to see how changes in the indicator’s settings affect its trend detection.



Customization and Default Settings
  • Important Note: The default settings provided are not optimized for any particular market or asset. They serve as a starting point for experimentation. Traders are encouraged to calibrate the system to suit their own trading strategies and preferences.
  • The indicator allows deep customization, from selecting which indicators to use, adjusting the lengths of each indicator, smoothing parameters, and the RSI weight system.



Alerts
Traders can set alerts for both long and short signals when the indicator flips, allowing for automated monitoring of potential trading opportunities.
Информация о релизе
- Fixed issue with indicator giving errors on lower timeframes (the issue may still persist if you are using backtest mode on lower timeframes and referencing more than 5000 bars, in which case you will have to change the Backtest Start Date for the backtest tool to work.)
Информация о релизе
// Added max_bars_back = 5000 to avoid some errors related to the backtest mode.
Информация о релизе
Updated the code to pinescript v6, added backtesting library v2 with more backtesting functions and removed old backtesting functions from the code
educationalstatisticsTrend Analysis

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности