OPEN-SOURCE SCRIPT

RTI Thresholds Index | mad_tiger_slayer

Zaktualizowano
Overview of the Script
The Relative Trend Index (RTI) Threshold Index is a custom indicator for TradingView that enhances a Relative Trend Index (RTI). The RTI is designed to reflect the market’s trend strength by comparing the current price to dynamically calculated upper and lower trend boundaries. Additionally, the indicator includes overbought and oversold thresholds, and Trend-coded signals to visually represent market conditions for easier analysis. The RTI Threshold Index is created and meant for long term investments targeted for longer swing trades over a few months to years.

How Do Investors Use the RTI Trend Index?
In the provided chart image, the indicator is displayed on a Bitcoin price chart. Here’s what each visual component represents:
snapshot

INTENDED USES
  • The RTI Threshold Index is NOT intended for SCALPING.
  • With the nature of its components and calculations. This indicator will give false signals when the Timeframe is too low. The best intended use for high-quality signals are above the 12hr timeframes (Note: Coded to be used above 1 Day Timeframes)
  • The RTI Threshold Index is a TREND-FOLLOWING and MEAN REVERTING INDICATOR. With the explanation below of the image you can see both Trend-Following and Mean Reversion Uses.

snapshot
A VISUAL REPRESENTATION INTENDED USES
  • Relative Trend Index Line (Green/Red): The main RTI line changes colors based on long or short conditions, providing an immediate visual cue of the trend direction. This conditional state enter long when the RTI is greater than the long threshold and will not enter short until it is less than the short threshold. (vice versa) When the RTI is less than the short threshold and will not enter long until it is greater than the long threshold.
  • EMA of RTI: A smoothed version of the RTI in yellow for more stable trend analysis. This EMA can be used for LONGER TERM trends. When the smoothed RTI is above 50, investors can assume that the trend will be in a trending state. Because this is slower than the RTI, you will get slower entries and slower exits.
  • Threshold Lines: Green and red lines for long and short thresholds, along with dashed lines for overbought and oversold levels. These lines can be calibrated to allow the RTI to enter a long trending or short trending state. The lower the value is for Long Threshold line, it will enter a long trend faster. The higher the value for Short Threshold Line, it will exit faster. We can also set Overbought and Oversold Thresholds. With the RTI entering above the Overbought Threshold line, Investors can assume that the environment is getting heated or is overbought. Same for oversold with the RTI entering below the Oversold Threshold line, Investors can assume that the environment is getting heated or is overbought.
  • Gradient Background: Shaded overbought and oversold areas improve readability by distinguishing these zones. This coloring of the shaded area tells us the oversold and overbought levels.
  • Colored Candles: Candles change color based on the RTI condition, aligning the price action visually with the trend status. The Green symbolizes a long state while red symbolizes a short state.

__________________________________________________________________________________

The indicator's primary elements include:
  • Input Parameters: Configurable settings for trend length, sensitivity, moving average (MA) period, thresholds, and overbought/oversold levels.
  • RTI Calculation: Computation of trend boundaries and the RTI value based on the price's position within these boundaries.
  • Visual Components: Horizontal threshold lines, plotted RTI values, color-coded candles, and gradient fills for overbought and oversold zones.


1. Input Parameters
The script includes several configurable inputs, allowing users to customize the indicator’s sensitivity and behavior according to market conditions:

  • Trend Length: Controls the number of data points for trend calculations. Higher values produce a smoother, less responsive trend, while lower values make the trend more sensitive to recent price changes.
  • Trend Sensitivity: Sets the sensitivity by defining the upper and lower percentiles for the trend boundaries. Higher sensitivity values make the RTI less reactive, while lower values increase responsiveness.
  • MA length: Defines the period for the Exponential Moving Average (EMA) applied to the RTI, smoothing its output.
  • longThreshold and shortThreshold: Set the levels for entering long and short positions. The RTI crossing above longThreshold or below shortThreshold signals a long or short condition, respectively.
  • Overbought and oversold thresholds: When RTI exceeds overbought or falls below oversold, it indicates overbought or oversold market conditions.


2. Relative Trend Index (RTI) Calculation
The RTI is calculated by dynamically setting upper and lower trend boundaries:

  • Upper Trend and Lower Trend: Calculated by adding and subtracting the standard deviation of the closing price to/from the close, providing a measure of price variation.
  • upper array and Lower Arrays : Arrays that hold the upper and lower trend values over the specified trend length period.
  • Sorting and Indexing: After sorting these arrays, the values at specific percentiles (based on trend sensitivity) are selected as UpperTrend and LowerTrend.
  • RTI formula: The RTI is calculated by normalizing the close price within the range of UpperTrend and LowerTrend. This yields a percentage that reflects the price's relative position within the trend range.


3. Threshold and Signal Lines
Several horizontal lines mark key threshold levels:

  • midline: A dashed line at 50, marking the RTI midpoint.
  • overbought and oversold: Dashed lines for the overbought and oversold levels as set by overbought and oversold.
  • long hline and short hline: Solid lines marking the longThreshold and shortThreshold levels for entering long and short trades. They are colored Green for long threshold and Red for short threshold


4. Long and Short Conditions
The script defines long and short conditions based on the RTI’s position relative to the longThreshold and shortThreshold:

  • isLong: Set to true when the RTI exceeds longThreshold, signaling a long condition.
  • isShort: Set to true when the RTI drops below shortThreshold, signaling a short condition.
  • overboughtcandles and oversoldcandles: Boolean variables that indicate when the RTI crosses the overbought or oversold thresholds, enhancing visual feedback.


5. Color Coding
Color-coded elements help to visually indicate the RTI's current state:

  • rtiColor: Sets the RTI line color based on the long or short condition (green for long, red for short).
  • obosColor: Colors specific candles in the overbought (yellow) and oversold (purple) regions, adding clarity to these conditions.


6. Plotting and Visualization
The following components display the RTI indicator and its conditions visually:

  • RTI and EMA Plot: The RTI line is plotted alongside an EMA line for smooth trend observation. The RTI line uses the conditional colors to indicate market conditions.
  • Background Gradient Fill: Shaded areas between the overbought and oversold levels highlight these zones in the background.
  • Colored Candles: Candles on the price chart are color-coded based on the RTI condition (green for long, red for short), making it easy to see trend direction changes.
  • Overbought and Oversold Gradient Fill: Gradient fills are applied to the overbought and oversold regions, creating a visual effect when the RTI reaches extreme levels.


Conclusion
The RTI Threshold Indicator is a powerful tool for assessing trend strength and market conditions. With configurable parameters, it adapts well to various timeframes and market environments, providing investors with a reliable means to identify potential entry and exit points. With configurable parameters, RTI Threshold Indicator can identify market conditions for potential buy and sell zones.
Informacje o Wersji
RTI Thresholds Index Update Overview
The latest update to the RTI Thresholds Index indicator by mad_tiger_slayer brings several improvements and new customization options to enhance trend analysis and visualization for investors. Because the previous problem of a too low maxval thresholds for both OB and OS, I increased the maxval to have a more uncommon opportunity that investors can exploit. Previously, investors using this overbought and oversold criteria would get lots of noise because of the trend entering long in the OB and OS criteria as well. This makes OB and OS seem much more common and invaluable.

Key Updates:
New Input Controls:
  • Adjustable Overbought and Oversold Thresholds: The Overbought and Oversold thresholds have been expanded to support a wider range of values (0 to 175 for overbought, and -45 to 100 for oversold). This change allows traders to better adjust the RTI levels based on individual trading strategies and risk tolerance.
  • Toggle for Threshold Lines: A new Plot OB and OS Threshold Lines? toggle lets users control the display of the Overbought and Oversold threshold lines. When enabled, these lines visually mark levels at which RTI may signal overbought or oversold conditions, improving chart clarity.

Enhanced Overbought and Oversold Level Visualizations:
*Solid Line Styling: The Overbought and Oversold lines have been enhanced with solid line styling for better visibility. This update includes an updated color scheme with semi-transparent hues to highlight these thresholds without overpowering the chart.
*New Fill Options: The fill between RTI and the overbought/oversold lines now uses color fills with varying transparency, making it easier to spot these critical levels directly on the chart. The gradient has been replaced with a more solid fill, allowing traders to focus on precise threshold interactions.

Updated Background Fill for Long/Short Conditions:

The area between the Enter Long and Enter Short thresholds now displays a teal background fill. This fill adds visual context for when the RTI is fluctuating between entry and exit levels, helping traders quickly identify potential long/short zones.
multitimeframeOscillatorsTrend Analysis

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?

Wyłączenie odpowiedzialności