OPEN-SOURCE SCRIPT

@tk · fractal rsi levels

█  OVERVIEW


This script is an indicator that helps traders to identify the RSI Levels for multiple fractals wherever the current timeframe is. This script was based on RSI Levels, 20-30 & 70-80 by abdomi indicator, that calculates the Relative Strenght Index levels based on the asset's price and plots it into the chart, creating a "wave" style indicator. The core feature of this indicator is the fractal rays, so trader can visualize each of the oversold and overbought levels of multiple timeframe on the current timeframe that he is on. The indicator will plots multiple rays after the chart bars. indicating where is the oversold and overbought levels for others fractals.



█  MOTIVATION


Since the RSI Levels, 20-30 & 70-80 by abdomi indicator helps a lot to identify the possible price levels when the asset is oversold or overbought, I saw myself drawing multiple horizontal lines on these levels in lower timeframes so, in an uptrend or downtrend, I can try to get a pullback of these trends when the asset reaches oversold or overboght levels. So, I get the idea to make those lines visible in multiple timeframes so I don't need to draw it myself manually anymore.



█  CONCEPT


The trading concept to use this indicator is the concept to make entries on uptrend or downtrend pullbacks when the asset price reaches oversold or overbought levels. But this strategy don't works alone. It needs to be aligned together with others indicators like Exponential Moving Averages, Chart Patterns, Support and Resistance, and so on... Even more confluences that you have, bigger are your chances to increase the probability for a successful trade. So, don't use this indicator alone. Compose a trading strategy and use it to improve your analysis.



█  CUSTOMIZATION


This indicator allows the trader to customize the following settings:

GENERAL

Text size
  Changes the font size of the labels to improve accessibility.
  Type: string
  Options: `tiny`, `small`, `normal`, `large`.
  Default: `small`

RSI LEVELS · SETTINGS

Pre-oversold Level
  Changes the RSI Level to calculate the "pre-oversold" price level on the chart.
  Type: int
  Min: 1
  Max: 49
  Default: 33

Pre-overbought Level
  Changes the RSI Level to calculate the "pre-overbought" price level on the chart.
  Type: int
  Min: 51
  Max: 100
  Default: 67

Show "Pre-over" Levels
  Enables / Disables the pre-oversold and pre-overbought levels on the chart.
  Type: bool
  Default: true

FRACTAL RAYS · SETTINGS

Length
  Changes the base length for the RSI calculation.
  Type: int
  Min: 1
  Default: 14

Source
  Changes the base source for the RSI calculation.
  Type: float
  Default: close

FRACTAL RAYS · STYLE

Ray Color
  Changes the color of all fractal rays and its label.
  Type: color
  Default: color.rgb(187, 74, 207)

Ray Style
  Changes the style of all fractal rays.
  Type: string
  Options: `line.style_solid`, `line.style_dashed`, `line.style_dotted`
  Default: line.style_dotted

Ray Length
  Changes the length of all fractal rays.
  Type: int
  Default: 15

FRACTAL RAYS · OVERSOLD

Oversold Level
  Changes the base RSI Level for fractal rays calculation.
  Type: int
  Min: 1
  Default: 30

Oversold Prefix
  Customizes the fractal ray label with a prefix text.
  Type: string
  Default: 🚀

Oversold Suffix
  Customizes the fractal ray label with a suffix text.
  Type: string
  Default: (empty)

FRACTAL RAYS · OVERBOUGHT

Overbought Level
  Changes the base RSI Level for fractal rays calculation.
  Type: int
  Min: 1
  Default: 70

Overbought Prefix
  Customizes the fractal ray label with a prefix text.
  Type: string
  Default: 🐻

Overbought Suffix
  Customizes the fractal ray label with a suffix text.
  Type: string
  Default: (empty)

FRACTAL RAYS · VISIBILITY RULES

These rules are applied for each of fractal rays so, the traders can choose what timeframes they wants to show the fractal rays for each of it. The rule will be applied as the following condition: `if timeframe != CURRENT_TIMEFRAME and timeframe <= CHOSEN_OPTION`. Actually, the fractal rays are on the chart but, isn't visible because it was applied a transparent color, so it is visually not on the chart to prevent chart's over polution.

LABELS


Show Labels on Price Scale
  Shows labels on price scale.
  Type: bool
  Default: false

Show Price on Fractal Rays
  Shows the RSI Level price on each of fractal rays respectively.
  Type: bool
  Default: false


█  EXTERNAL LIBRARIES


This script uses the `tk` library to calculate RSI Levels. It is a library that contains various functions that helps pine script developers to calculate RSI Levels.



█  FUNCTIONS


The library contains the following functions:


fn_fractalVisibilityRule(string visibilityRule)
  Converts the fractal rays timeframe visibility rule label to timestamp int.
  Parameters:
    visibilityRule: (string) Fractal ray visibility rule label.
  Returns: (int) Fractal ray visibility rule timestamp.


fn_requestFractal(string period, expression)
  Converts the fractal rays timeframe visibility rule label to timestamp int.
  Parameters:
    period: (string) Timeframe period for the desired fractal.
    expression: (mixed) Security expression that will be applied for calculation.
  Returns: (mixed) A result determined by expression.


fn_plotRay(float y, string label, color color, int length)
  Plots ray after chart bars for the current time.
  Parameters:
    period: (string) Timeframe period for the desired fractal.
    expression: (mixed) Security expression that will be applied for calculation.
  Returns: (void) This function only plots the elements into the chart


fn_plotRsiLevelRay(simple string period, simple int level, color color)
  Plots RSI Levels ray after chart bars for the current time.
  Parameters:
    period: (simple string) Timeframe period.
    level: (simple int) Relative Strength Index level.
    color: (color) The color of both, ray and label text.
  Returns: (void) This function only plots the elements into the chart
cryptocustomizableFractalfractalesfractalrsilevelsmultipletimeframerelativestrengthRelative Strength Index (RSI)rsilevelsSharkTK

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer