OPEN-SOURCE SCRIPT

RSI Multiple TimeFrame, Version 1.0

RSI Multiple TimeFrame, Version 1.0

Overview

The RSI Multiple TimeFrame script is designed to enhance trading decisions by providing a comprehensive view of the Relative Strength Index (RSI) across multiple timeframes. This tool helps traders identify overbought and oversold conditions more accurately by analyzing RSI values on different intervals simultaneously. This is particularly useful for traders who employ multi-timeframe analysis to confirm signals and make more informed trading decisions.

Unique Feature of the new script (described in detail below)

  • Multi-Timeframe RSI Analysis
  • Customizable Timeframes
  • Visual Signal Indicators (dots)
  • Overbought and Oversold Layers with gradual Background Fill
  • Enhanced Trend Confirmation


Originality and Usefulness

This script combines the RSI indicator across three distinct timeframes into a single view, providing traders with a multi-dimensional perspective of market momentum. It also provides associated signals to better time dips and peaks. Unlike standard RSI indicators that focus on a single timeframe, this script allows users to observe RSI trends across short, medium, and long-term intervals, thereby improving the accuracy of entry and exit signals. This is particularly valuable for traders looking to align their short-term strategies with longer-term market trends.

Signal Description

The script also includes a unique signal feature that plots green and red dots on the chart to highlight potential buy and sell opportunities:

  • Green Dots: These appear when all three RSI values are under specific thresholds (RSI of the shortest timeframe < 30, the medium timeframe < 40, and the longest timeframe < 50) and the RSI of the shortest timeframe is showing an upward trend (current value is greater than the previous value, and the value two periods ago is greater than the previous value). This indicates a potential buying opportunity as the market may be shifting from an oversold condition.

  • Red Dots: These appear when all three RSI values are above specific thresholds (RSI of the shortest timeframe > 70, the medium timeframe > 60, and the longest timeframe > 50) and the RSI of the shortest timeframe is showing a downward trend (current value is less than the previous value, and the value two periods ago is less than the previous value). This indicates a potential selling opportunity as the market may be shifting from an overbought condition.


These signals help traders identify high-probability turning points in the market by ensuring that momentum is aligned across multiple timeframes.

Detailed Description

Input Variables

  • RSI Period (`len`) : The number of periods to calculate the RSI. Default is 14.
  • RSI Source (`src`) : The price source for RSI calculation, defaulting to the average of the high and low prices (`hl2`).
  • Timeframes (`tf1`, `tf2`, `tf3`) : The different timeframes for which the RSI is calculated, defaulting to 5 minutes, 1 hour, and 8 hours respectively.


Functionality

  1. RSI Calculations: The script calculates the RSI for each of the three specified timeframes using the `request.security` function. This allows the RSI to be plotted for multiple intervals, providing a layered view of market momentum.

    ```pine
    rsi_tf1 = request.security(syminfo.tickerid, tf1, ta.rsi(src, len))
    rsi_tf2 = request.security(syminfo.tickerid, tf2, ta.rsi(src, len))
    rsi_tf3 = request.security(syminfo.tickerid, tf3, ta.rsi(src, len))
    ```

  2. Plotting: The RSI values for the three timeframes are plotted with different colors and line widths for clear visual distinction. This makes it easy to compare RSI values across different intervals.

    ```pine
    p1 = plot(rsi_tf1, title="RSI 5m", color=color.rgb(200, 200, 255), linewidth=2)
    p2 = plot(rsi_tf2, title="RSI 1h", color=color.rgb(125, 125, 255), linewidth=2)
    p3 = plot(rsi_tf3, title="RSI 8h", color=color.rgb(0, 0, 255), linewidth=2)
    ```

  3. Overbought and Oversold Levels: Horizontal lines are plotted at standard RSI levels (20, 30, 40, 50, 60, 70, 80) to visually identify overbought and oversold conditions. The areas between these levels are filled with varying shades of blue for better visualization.

    ```pine
    h80 = hline(80, title="RSI threshold 80", color=color.gray, linestyle=hline.style_dotted, linewidth=1)
    h70 = hline(70, title="RSI threshold 70", color=color.gray, linestyle=hline.style_dotted, linewidth=1)
    ...
    fill(h70, h80, color=color.rgb(33, 150, 243, 95), title="Background")
    ```

  4. Signal Plotting: The script adds green and red dots to indicate potential buy and sell signals, respectively. A green dot is plotted when all RSI values are under specific thresholds and the RSI of the shortest timeframe is rising. Conversely, a red dot is plotted when all RSI values are above specific thresholds and the RSI of the shortest timeframe is falling.

    ```pine
    plotshape(series=(rsi_tf1 < 30 and rsi_tf2 < 40 and rsi_tf3 < 50 and (rsi_tf1 > rsi_tf1[1]) and (rsi_tf1[2] > rsi_tf1[1])) ? 1 : na, location=location.bottom, color=color.green, style=shape.circle, size=size.tiny)
    plotshape(series=(rsi_tf1 > 70 and rsi_tf2 > 60 and rsi_tf3 > 50 and (rsi_tf1 < rsi_tf1[1]) and (rsi_tf1[2] < rsi_tf1[1])) ? 1 : na, location=location.top, color=color.red, style=shape.circle, size=size.tiny)
    ```


How to Use

  1. Configuring Inputs: Adjust the RSI period and source as needed. Modify the timeframes to suit your trading strategy.
  2. Interpreting the Indicator: Use the plotted RSI values to gauge momentum across different timeframes. Look for overbought conditions (RSI above 70, 60 and 50) and oversold conditions (RSI below 30, 40 and 50) across multiple intervals to confirm trade signals.
  3. Signal Confirmation: Pay attention to the green and red dots that provide signals to better time dips and peaks. dots are printed when the lower timeframe (5mn by default) shows sign of reversal.
These signals are more reliable when confirmed across all three timeframes.

This script provides a nuanced view of RSI, helping traders make more informed decisions by considering multiple timeframes simultaneously. By combining short, medium, and long-term RSI values, traders can better align their strategies with overarching market trends, thus improving the precision of their trading actions.
multitimeframeRelative Strength Index (RSI)

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?


Anche su:

Declinazione di responsabilità