Indicator Description
Name: Multi-TimeFrame RSI Board with Warnings & Alerts
Purpose:
This indicator calculates and displays the Relative Strength Index (RSI) values for six user-selectable timeframes in a fixed-position table on your chart. It not only shows the current RSI values with dynamic background and text coloring (to reflect overbought and oversold conditions) but also monitors four configurable pairs of timeframes. If both timeframes in a pair are simultaneously oversold or overbought, the indicator triggers an alert condition.
Key Features:
Multi-TimeFrame RSI Calculation:
The indicator uses a single user-defined RSI period (default is 14) to calculate the RSI values.
Six different timeframes (e.g., "1", "5", "15", "60", "240", "D") are available as inputs.
These values are computed using the request.security function and updated in real time.
Fixed RSI Board (Table):
A table is displayed on your chart, fixed to one of the viewport corners (Top Left, Top Right, Bottom Left, or Bottom Right) based on your selection.
The table has a header row that dynamically labels each column with the respective timeframe (e.g., "RSI 1", "RSI 5", etc.).
The data row shows the RSI values for each timeframe, formatted to two decimal places.
Dynamic Cell Coloring and Readable Text:
Each RSI cell’s background color is determined by its value relative to user-defined overbought and oversold thresholds (defaults are 70 and 30, respectively):
Below the oversold threshold: The cell background is green.
Above the overbought threshold: The cell background is red.
Intermediate values: The background color interpolates from green to yellow (if the value is between oversold and 50) and from yellow to red (if the value is between 50 and overbought).
A helper function sets the text color (black or white) dynamically for optimum readability against the colored background.
Warning Pairs and Alert Conditions:
Four warning pairs are defined, each comparing two different timeframes. The default pairs are:
Pair 1: M1 with M5 (e.g., "1" and "5")
Pair 2: M5 with M15 (e.g., "5" and "15")
Pair 3: M30 with H1 (e.g., "30" and "60")
Pair 4: H1 with H4 (e.g., "60" and "240")
For each pair, the indicator calculates RSI values on the two selected timeframes.
An alert condition is triggered if both RSI values in a pair are simultaneously:
Oversold: (i.e., both are below the oversold threshold)
Overbought: (i.e., both are above the overbought threshold)
Since Pine Script requires alert messages to be constant strings, the alert messages are fixed (for example, "Pair 1 oversold: both RSIs are below threshold.").
User Manual
Installation and Setup:
Adding the Indicator:
Open TradingView and navigate to the Pine Script Editor.
Create a new indicator script, paste the complete code provided, and save it.
Add the indicator to your chart.
Configuring the RSI Calculation:
RSI Period: Set the RSI period (default is 14). This period is applied to all timeframe calculations.
Timeframe Inputs for the Board: Enter the six timeframes you want to monitor (for example, "1", "5", "15", "60", "240", "D"). These should be entered as strings.
Setting Thresholds:
Overbought Threshold: Default is 70.
Oversold Threshold: Default is 30.
These thresholds determine the dynamic cell background colors and the alert conditions.
Positioning the RSI Board:
Choose the desired position for the table using the dropdown (e.g., "Top Left"). The table will appear in that fixed corner of your viewport.
Configuring Warning Pairs:
Four warning pairs are provided by default. For each pair, you can choose two timeframes:
Pair 1: Example defaults are "1" and "5".
Pair 2: Example defaults are "5" and "15".
Pair 3: Example defaults are "30" and "60".
Pair 4: Example defaults are "60" and "240".
You can change these values to any valid timeframe strings as desired.
Using the Indicator:
Monitoring the RSI Board:
Once added to your chart, the table will display the RSI values for the six timeframes you configured.
The header row shows labels like "RSI 1", "RSI 5", etc.
The data row displays the RSI values. Each cell’s background color changes dynamically:
Green when the RSI is low (oversold).
Red when the RSI is high (overbought).
A gradient color for intermediate values.
The text color adjusts automatically for readability.
Understanding the Warning Pairs:
The indicator continuously monitors the four warning pairs.
If both RSI values in a pair are simultaneously below the oversold threshold, the indicator triggers an oversold alert for that pair.
If both RSI values in a pair are simultaneously above the overbought threshold, an overbought alert is triggered for that pair.
Setting Up Alerts in TradingView:
Open the TradingView alert dialog.
Select the indicator’s alert conditions (e.g., "Warning Pair 1 Oversold", "Warning Pair 1 Overbought", etc.).
Configure your alert notification settings (sound, email, SMS, etc.).
These alerts will notify you whenever the specified warning conditions are met.
Customization:
Adjust the RSI period, thresholds, timeframes, and warning pair timeframes as needed via the input options.
The alert messages are fixed, but you can modify the code if you wish to change the wording (keeping in mind they must remain constant strings).
Additional Tips:
Testing:
Before relying on the alerts in live trading, test the indicator on historical data to ensure that the warning conditions and dynamic color changes behave as expected.
Further Customizations:
You might consider adding features such as:
Additional rows or columns in the table for other indicators.
More refined gradient or text color functions based on your visual preference.
Extra alert conditions (such as RSI delta changes) if desired.