Advanced Dynamic Threshold RSI [Elysian_Mind]

Advanced Dynamic Threshold RSI Indicator


The Advanced Dynamic Threshold RSI Indicator is a powerful tool designed for traders seeking a unique approach to RSI-based signals. This indicator combines traditional RSI analysis with dynamic threshold calculation and optional Bollinger Bands to generate weighted buy and sell signals.


  1. Dynamic Thresholds: The indicator calculates dynamic thresholds based on market volatility, providing more adaptive signal generation.
  2. Performance Analysis: Users can evaluate recent price performance to further refine signals. The script calculates the percentage change over a specified lookback period.
  3. Bollinger Bands Integration: Optional integration of Bollinger Bands for additional confirmation and visualization of potential overbought or oversold conditions.
  4. Customizable Settings: Traders can easily customize key parameters, including RSI length, SMA length, lookback bars, threshold multiplier, and Bollinger Bands parameters.
  5. Weighted Signals: The script introduces a unique weighting mechanism for signals, reducing false positives and improving overall reliability.

Underlying Calculations and Methods

1. Dynamic Threshold Calculation:

The heart of the Advanced Dynamic Threshold RSI Indicator lies in its ability to dynamically calculate thresholds based on multiple timeframes. Let's delve into the technical details:

RSI Calculation:

For each specified timeframe (1-hour, 4-hour, 1-day, 1-week), the Relative Strength Index (RSI) is calculated using the standard 14-period formula.


The Simple Moving Average (SMA) is applied to each RSI, resulting in the smoothing of RSI values. This smoothed RSI becomes the basis for dynamic threshold calculations.

Dynamic Adjustment:

The dynamically adjusted threshold for each timeframe is computed by adding a constant value (5 in this case) to the respective SMA of RSI. This dynamic adjustment ensures that the threshold reflects changing market conditions.

2. Weighted Signal System:

To enhance the precision of buy and sell signals, the script introduces a weighted signal system. Here's how it works technically:

Signal Weighting:

The script assigns weights to buy and sell signals based on the crossover and crossunder events between RSI and the dynamically adjusted thresholds. If a crossover event occurs, the weight is set to 2; otherwise, it remains at 1.

Signal Combination:

The weighted buy and sell signals from different timeframes are combined using logical operations. A buy signal is generated if the product of weights from all timeframes is equal to 2, indicating alignment across timeframe.

3. Experimental Enhancements:

The Advanced Dynamic Threshold RSI Indicator incorporates experimental features for educational exploration. While not intended as proven strategies, these features aim to offer users a glimpse into unconventional analysis. Some of these features include Performance Calculation, Volatility Calculation, Dynamic Threshold Calculation Using Volatility, Bollinger Bands Module, Weighted Signal System Incorporating New Features.

3.1 Performance Calculation:

The script calculates the percentage change in the price over a specified lookback period (variable lookbackBars). This provides a measure of recent performance.

pctChange(src, length) =>
    change = src - src[length]
    pctChange = (change / src[length]) * 100

recentPerformance1H = pctChange(close, lookbackBars)
recentPerformance4H = pctChange(request.security(syminfo.tickerid, "240", close), lookbackBars)
recentPerformance1D = pctChange(request.security(syminfo.tickerid, "1D", close), lookbackBars)

3.2 Volatility Calculation:

The script computes the standard deviation of the closing price to measure volatility.

volatility1H = ta.stdev(close, 20)
volatility4H = ta.stdev(request.security(syminfo.tickerid, "240", close), 20)
volatility1D = ta.stdev(request.security(syminfo.tickerid, "1D", close), 20)

3.3 Dynamic Threshold Calculation Using Volatility:

The dynamic thresholds for RSI are calculated by adding a multiplier of volatility to 50.

dynamicThreshold1H = 50 + thresholdMultiplier * volatility1H
dynamicThreshold4H = 50 + thresholdMultiplier * volatility4H
dynamicThreshold1D = 50 + thresholdMultiplier * volatility1D

3.4 Bollinger Bands Module:

An additional module for Bollinger Bands is introduced, providing an option to enable or disable it.

// Additional Module: Bollinger Bands
bbLength = input(20, title="Bollinger Bands Length")
bbMultiplier = input(2.0, title="Bollinger Bands Multiplier")
upperBand = ta.sma(close, bbLength) + bbMultiplier * ta.stdev(close, bbLength)
lowerBand = ta.sma(close, bbLength) - bbMultiplier * ta.stdev(close, bbLength)

3.5 Weighted Signal System Incorporating New Features:

Buy and sell signals are generated based on the dynamic threshold, recent performance, and Bollinger Bands.

weightedBuySignal = rsi1H > dynamicThreshold1H and rsi4H > dynamicThreshold4H and rsi1D > dynamicThreshold1D and crossOver1H
weightedSellSignal = rsi1H < dynamicThreshold1H and rsi4H < dynamicThreshold4H and rsi1D < dynamicThreshold1D and crossUnder1H

These features collectively aim to provide users with a more comprehensive view of market dynamics by incorporating recent performance and volatility considerations into the RSI analysis. Users can experiment with these features to explore their impact on signal accuracy and overall indicator performance.

Indicator Placement for Enhanced Visibility


The design choice to position the "Advanced Dynamic Threshold RSI" indicator both on the main chart and beneath it has been carefully considered to address specific challenges related to visibility and scaling, providing users with an improved analytical experience.

Challenges Faced

1. Differing Scaling of RSI Results:

  • RSI values for different timeframes (1-hour, 4-hour, and 1-day) often exhibit different scales, especially in markets like gold.
  • Attempting to display these RSIs on the same chart can lead to visibility issues, as the scaling differences may cause certain RSI lines to appear compressed or nearly invisible.

2. Candlestick Visibility vs. RSI Scaling:

  • Balancing the visibility of candlestick patterns with that of RSI values posed a unique challenge.
  • A single pane for both candlesticks and RSIs may compromise the clarity of either, particularly when dealing with assets that exhibit distinct volatility patterns.

Design Solution

  • Placing the buy/sell signals above/below the candles helps to maintain a clear association between the signals and price movements.
  • By allocating RSIs beneath the main chart, users can better distinguish and analyze the RSI values without interference from candlestick scaling.
  • Doubling the scaling of the 1-hour RSI (displayed in blue) addresses visibility concerns and ensures that it remains discernible even when compared to the other two RSIs: 4-hour RSI (orange) and 1-day RSI (green).
  • Bollinger Bands Module is optional, but is turned on as default. When the module is turned on, the users can see the upper Bollinger Band (green) and lower Bollinger Band (red) on the main chart to gain more insight into price actions of the candles.

User Flexibility

  • This dual-placement approach offers users the flexibility to choose their preferred visualization:
  • The main chart provides a comprehensive view of buy/sell signals in relation to candlestick patterns.
  • The area beneath the chart accommodates a detailed examination of RSI values, each in its own timeframe, without compromising visibility.

The chosen design optimizes visibility and usability, addressing the unique challenges posed by differing RSI scales and ensuring users can make informed decisions based on both price action and RSI dynamics.



To ensure you receive updates and enhancements seamlessly, follow these steps:

  1. Open the TradingView platform.
  2. Navigate to the "Indicators" tab in the top menu.
  3. Click on "Community Scripts" and search for "Advanced Dynamic Threshold RSI Indicator."
  4. Select the indicator from the search results and click on it to add to your chart.

This ensures that any future updates to the indicator can be easily applied, keeping you up-to-date with the latest features and improvements.

Review Code

  1. Open TradingView and navigate to the Pine Editor.
  2. Copy the provided script.
  3. Paste the script into the Pine Editor.
  4. Click "Add to Chart."


The indicator offers several customizable settings:

  • RSI Length: Defines the length of the RSI calculation.
  • SMA Length: Sets the length of the SMA applied to the RSI.
  • Lookback Bars: Determines the number of bars used for recent performance analysis.
  • Threshold Multiplier: Adjusts the multiplier for dynamic threshold calculation.
  • Enable Bollinger Bands: Allows users to enable or disable Bollinger Bands integration.

Interpreting Signals

  • Buy Signal: Generated when RSI values are above dynamic thresholds and a crossover occurs.
  • Sell Signal: Generated when RSI values are below dynamic thresholds and a crossunder occurs.

Additional Information

  • The indicator plots scaled RSI lines for 1-hour, 4-hour, and 1-day timeframes.
  • Users can experiment with additional modules, such as machine-learning simulation, dynamic real-life improvements, or experimental signal filtering, depending on personal preferences.


The Advanced Dynamic Threshold RSI Indicator provides traders with a sophisticated tool for RSI-based analysis, offering a unique combination of dynamic thresholds, performance analysis, and optional Bollinger Bands integration. Traders can customize settings and experiment with additional modules to tailor the indicator to their trading strategy.

Disclaimer: Use of the Advanced Dynamic Threshold RSI Indicator

The Advanced Dynamic Threshold RSI Indicator is provided for educational and experimental purposes only. The indicator is not intended to be used as financial or investment advice. Trading and investing in financial markets involve risk, and past performance is not indicative of future results.

The creator of this indicator is not a financial advisor, and the use of this indicator does not guarantee profitability or specific trading outcomes. Users are encouraged to conduct their own research and analysis and, if necessary, consult with a qualified financial professional before making any investment decisions.

It is important to recognize that all trading involves risk, and users should only trade with capital that they can afford to lose. The Advanced Dynamic Threshold RSI Indicator is an experimental tool that may not be suitable for all individuals, and its effectiveness may vary under different market conditions.

By using this indicator, you acknowledge that you are doing so at your own risk and discretion. The creator of this indicator shall not be held responsible for any financial losses or damages incurred as a result of using the indicator.

Kind regards,

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟