Indicator · Pine Script v6 · Own pane

RSI fixed timeframe

by InNoobWeTrust

This indicator calculates the Relative Strength Index and a smoothed moving average across a selectable fixed timeframe, plotting the values in a separate pane.

View on GitHub

GitHub stars4on the repository
Pine versionv6current
Lines of code117
Settings21inputs
LicenceNone statedfile: MPL-2.0
Last update2 days ago28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

117 lines of Pine Script v6 from .innoobwetrust/life_hacks/tradingview/rsi_fixed_tf.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

rsi_fixed_tf.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © InNoobWeTrust

//@version=6
indicator("RSI fixed timeframe", overlay = false)

//===============================================================================
// Types
//===============================================================================
enum MaT
    sma = 'SMA'
    wma = 'WMA'
    ema = 'ema'

//===============================================================================
// Functions
//===============================================================================
ma(MaT t, src, int len) =>
    switch t
        MaT.sma => ta.sma(src,len)
        MaT.wma => ta.wma(src,len)
        MaT.ema => ta.ema(src,len)

//===============================================================================
// Input
//===============================================================================
tf = input.timeframe('','► Timeframe')

threshold_grp = '► Thresholds'
threshold_low_limit = input.float(30,'Low threshold',minval=0,maxval=50,group = threshold_grp)
threshold_high_limit = input.float(70,'High threshold',minval=50,maxval=100,group = threshold_grp)
threshold_color_inline = 'Threshold colors (middle line to low/high)'
threshold_color_middle_low = input.color(color.new(color.blue,90),threshold_color_inline,group = threshold_grp,inline = threshold_color_inline)
threshold_color_middle_high = input.color(color.new(color.yellow,90),'',group = threshold_grp,inline = threshold_color_inline)

rsi_grp = '► RSI'
rsi_src = input.source(close,'RSI source',group = rsi_grp)
rsi_len = input.int(14,'RSI length',group = rsi_grp)
rsi_ma_inline = 'RSI MA'
rsi_ma_type = input.enum(MaT.sma,rsi_ma_inline,group = rsi_grp,inline = rsi_ma_inline)
rsi_ma_len = input.int(14,'',group = rsi_grp,inline = rsi_ma_inline)
oversold_color = input.color(color.new(color.green,50),'Oversold area color',group = rsi_grp)
overbought_color = input.color(color.new(color.red,50),'Overbought area color',group = rsi_grp)

bg_grp = '► Oversold/overbought chart background'
bg_enable = input.bool(true,'Enable',group = bg_grp)
bg_color_inline = 'Background colors (oversold/overbought)'
bg_overbought_color = input.color(color.new(color.orange,90),bg_color_inline,group = bg_grp,inline = bg_color_inline)
bg_oversold_color = input.color(color.new(color.aqua,90),'',group = bg_grp,inline = bg_color_inline)

cross_grp = '► Cross signal background'
cross_signal_line = input.string('MA','Signal line',options = ['RSI','MA'],group = cross_grp)
cross_high_inline = 'High threshold'
cross_high_enable = input.bool(true,cross_high_inline,group = cross_grp,inline = cross_high_inline)
cross_high_threshold = input.int(60,'',group = cross_grp,inline = cross_high_inline)
cross_high_bg_color = input.color(color.new(color.maroon,25),'',group = cross_grp,inline = cross_high_inline)
cross_low_inline = 'Low threshold'
cross_low_enable = input.bool(true,cross_low_inline,group = cross_grp,inline = cross_low_inline)
cross_low_threshold = input.int(40,'',group = cross_grp,inline = cross_low_inline)
cross_low_bg_color = input.color(color.new(color.navy,25),'',group = cross_grp,inline = cross_low_inline)

//===============================================================================
// Calculation
//===============================================================================

// RSI
rsi = ta.rsi(rsi_src,rsi_len)
tf_rsi = request.security(syminfo.tickerid,tf,rsi)
tf_rsi_ma = ma(rsi_ma_type,tf_rsi,rsi_ma_len)
oversold_area_color = tf_rsi <= threshold_low_limit ? oversold_color : na
overbought_area_color = tf_rsi >= threshold_high_limit ? overbought_color : na

// Cross
cross_signal = switch cross_signal_line
    'RSI' => tf_rsi
    'MA' => tf_rsi_ma
signal_cross_high = ta.cross(cross_signal,cross_high_threshold)
signal_cross_low = ta.cross(cross_signal,cross_low_threshold)

//===============================================================================
// Visual calculation
//===============================================================================
chart_bg_color = switch
    bg_enable and tf_rsi <= threshold_low_limit => bg_oversold_color
    bg_enable and tf_rsi >= threshold_high_limit => bg_overbought_color
    => color(na)
bg_color = switch
    cross_high_enable and signal_cross_high => cross_high_bg_color
    cross_low_enable and signal_cross_low => cross_low_bg_color
    => color(na)

//===============================================================================
// Plot
//===============================================================================

// Thresholds
low_line = hline(threshold_low_limit,'Index Low threshold',linestyle = hline.style_dashed,color=color.new(color.gray,50))
middle_line = hline(50,'Index Middle',linestyle = hline.style_dashed,color=color.new(color.gray,50))
high_line = hline(threshold_high_limit,'Index High threshold',linestyle = hline.style_dashed,color=color.new(color.gray,50))
fill(low_line,middle_line,threshold_color_middle_low)
fill(high_line,middle_line,threshold_color_middle_high)

// Cross thresholds
cross_high_line = hline(cross_high_enable ? cross_high_threshold : na,'Cross high threshold',linestyle = hline.style_dotted,color = color.new(color.gray,70))
cross_low_line = hline(cross_low_enable ? cross_low_threshold : na,'Cross low threshold',linestyle = hline.style_dotted,color = color.new(color.gray,70))

// RSI
plot(tf_rsi,'RSI',color.purple,force_overlay = false)
plot(tf_rsi_ma,'RSI MA', color.yellow,force_overlay = false)
plot(rsi,'Oversold',oversold_area_color,style = plot.style_area,histbase = threshold_low_limit)
plot(rsi,'Overbought',overbought_area_color,style = plot.style_area,histbase = threshold_high_limit)

// Chart background
bgcolor(chart_bg_color,force_overlay = true)

// Panel background
bgcolor(bg_color,force_overlay = false)

Overview

Users can customize the timeframe, RSI length, calculation source, moving average smoothing type, and overbought or oversold boundary thresholds. The script displays colored background highlights when the RSI or its signal moving average crosses predefined threshold boundaries. As an indicator, it provides visual market analysis without automated entry, exit, or trade management logic.

Details

Published by

InNoobWeTrust on GitHub

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

dotfiles

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
► Timeframetimeframetf
Low thresholdfloat30threshold_low_limit
High thresholdfloat70threshold_high_limit
threshold_color_middle_lowcolorcolor.new(color.blue,90)threshold_color_middle_low
threshold_color_middle_highcolorcolor.new(color.yellow,90)threshold_color_middle_high
RSI sourcesourceclosersi_src
RSI lengthint14rsi_len
rsi_ma_typeenumMaT.smarsi_ma_type
rsi_ma_lenint14rsi_ma_len
Oversold area colorcolorcolor.new(color.green,50)oversold_color
Overbought area colorcolorcolor.new(color.red,50)overbought_color
Enablebooltruebg_enable
Show all 21 settings
SettingTypeDefaultVariable
bg_overbought_colorcolorcolor.new(color.orange,90)bg_overbought_color
bg_oversold_colorcolorcolor.new(color.aqua,90)bg_oversold_color
Signal linestringMAcross_signal_line
cross_high_enablebooltruecross_high_enable
cross_high_thresholdint60cross_high_threshold
cross_high_bg_colorcolorcolor.new(color.maroon,25)cross_high_bg_color
cross_low_enablebooltruecross_low_enable
cross_low_thresholdint40cross_low_threshold
cross_low_bg_colorcolorcolor.new(color.navy,25)cross_low_bg_color
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

947 stars

The Derivative Oscillator calculates a double-exponentially smoothed Relative Strength Index (RSI) and subtracts its Simple Moving Average (SMA) to form the main oscillator line. A secondary signal line is plotted using an SMA of the main oscillator values. Th

Indicator v4 Oscillators & momentumMoving averages
Updated 12 days ago · GPL-3.0 GitHub repository of Derivative Oscillator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

MACD

by Alorse
330 stars

This indicator calculates and plots the standard Moving Average Convergence Divergence oscillator in a separate pane. It computes the difference between a fast and slow moving average, derives a signal line through smoothing, and plots a histogram representing

Indicator v4 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of MACD
228 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

MACD-V

by harryguiacorn
220 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers