RSI Multi Time Frame (MTF). Fully customizable. [Zero54]
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// Zero54. 

//@version=5
indicator("RSI MTF Z54")
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
ob = input.float(70,step=10,title="Over Bought level",group='RSI Settings')
os   = input.float(30,step=10,title="Over Sold level",group='RSI Settings')

MTF1 = input.timeframe('30', "TimeFrame 1",group='TimeFrame Settings')
MTF2 = input.timeframe('60', "TimeFrame 2",group='TimeFrame Settings')
MTF3 = input.timeframe('120', "TimeFrame 3",group='TimeFrame Settings')
MTF4 = input.timeframe('D', "TimeFrame 4",group='TimeFrame Settings')
head_tcolor = input(color.new(#ffffff,70),'Header Text Color',group='Table Style')
head_area = input(color.new(#CCffff,70),'Header Background Color',group='Table Style')
ob_area = input(color.new(#0cb51a,70),'Over Bought Background Color',group='Table Style')
os_area = input(color.new(#ff1100,70),'Over Sold Background Color',group='Table Style')
mid_area = input(color.new(#ff1100,70),'Mid-Range Background Color',group='Table Style')
ob_tcolor = input(color.new(#0cb51a,70),'Over Bought Text Color',group='Table Style')
os_tcolor = input(color.new(#ff1100,70),'Over Sold Text Color',group='Table Style')
mid_tcolor = input(color.new(#ff1100,70),'Mid-Range Text Color',group='Table Style')
plot(ta.rsi(rsiSourceInput,rsiLengthInput), "RSI", #FF006E)
rsiLowerBand = hline(40, "RSI Lower Band", color=#fa9589)
rsiMidBand = hline(50, "RSI Mid Band", color=#56adf0)
rsiHiBand = hline(60, "RSI High Band", color=#8affb7)

RSIMFT1 = request.security(syminfo.tickerid, MTF1, ta.rsi(rsiSourceInput,rsiLengthInput))
RSIMFT2 = request.security(syminfo.tickerid, MTF2, ta.rsi(rsiSourceInput,rsiLengthInput))
RSIMFT3 = request.security(syminfo.tickerid, MTF3, ta.rsi(rsiSourceInput,rsiLengthInput))
RSIMFT4 = request.security(syminfo.tickerid, MTF4, ta.rsi(rsiSourceInput,rsiLengthInput))

RSIMFT1bg =
     (RSIMFT1 >= ob) ? ob_area :
     (RSIMFT1 <= os) ? os_area :
     (RSIMFT1 < ob and RSIMFT1 > os) ? mid_area :
     na

RSIMFT2bg =
     (RSIMFT2 >= ob) ? ob_area :
     (RSIMFT2 <= os) ? os_area :
     (RSIMFT2 < ob and RSIMFT2 > os) ? mid_area :
     na

RSIMFT3bg =
     (RSIMFT3 >= ob) ? ob_area :
     (RSIMFT3 <= os) ? os_area :
     (RSIMFT3 < ob and RSIMFT3 > os) ? mid_area :
     na

RSIMFT4bg =
     (RSIMFT4 >= ob) ? ob_area :
     (RSIMFT4 <= os) ? os_area :
     (RSIMFT4 < ob and RSIMFT4 > os) ? mid_area :
     na

RSIMFT1txt =
     (RSIMFT1 >= ob) ? ob_tcolor :
     (RSIMFT1 <= os) ? os_tcolor :
     (RSIMFT1 < ob and RSIMFT1 > os) ? mid_tcolor :
     na

RSIMFT2txt =
     (RSIMFT2 >= ob) ? ob_tcolor :
     (RSIMFT2 <= os) ? os_tcolor :
     (RSIMFT2 < ob and RSIMFT2 > os) ? mid_tcolor :
     na

RSIMFT3txt =
     (RSIMFT3 >= ob) ? ob_tcolor :
     (RSIMFT3 <= os) ? os_tcolor :
     (RSIMFT3 < ob and RSIMFT3 > os) ? mid_tcolor :
     na

RSIMFT4txt =
     (RSIMFT4 >= ob) ? ob_tcolor :
     (RSIMFT4 <= os) ? os_tcolor :
     (RSIMFT4 < ob and RSIMFT4 > os) ? mid_tcolor :
     na

//----
var tb = table.new(position.top_right,4,2)
if barstate.islast
    table.cell(tb,0,0,MTF1,text_color=head_tcolor,bgcolor=head_area)
    table.cell(tb,1,0,MTF2,text_color=head_tcolor,bgcolor=head_area)
    table.cell(tb,2,0,MTF3,text_color=head_tcolor,bgcolor=head_area)
    table.cell(tb,3,0,MTF4,text_color=head_tcolor,bgcolor=head_area)
    
    table.cell(tb,0,1,str.tostring(RSIMFT1,'#.##'),text_color=RSIMFT1txt,bgcolor=RSIMFT1bg)
    table.cell(tb,1,1,str.tostring(RSIMFT2,'#.##'),text_color=RSIMFT2txt,bgcolor=RSIMFT2bg)
    table.cell(tb,2,1,str.tostring(RSIMFT3,'#.##'),text_color=RSIMFT3txt,bgcolor=RSIMFT3bg)
    table.cell(tb,3,1,str.tostring(RSIMFT4,'#.##'),text_color=RSIMFT4txt,bgcolor=RSIMFT4bg)
//----
