OPEN-SOURCE SCRIPT

RTI Thresholds Index | mad_tiger_slayer

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:
スナップショット

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.

スナップショット
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.
multitimeframeOscillatorsTrend Analysis

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?

免責事項