//version=5
indicator('Royal Scanner', overlay=true)

////////////
// INPUTS //

// SMA
rsi_len = input.int( 14, title = "RSI Length", group = "Indicators")
rsi_os = input.float(30, title = "RSI Overbought", group = "Indicators")
rsi_ob = input.float(70, title = "RSI Oversold", group = "Indicators")

// TSI
tsi_long_len = input.int( 25, title = "TSI Long Length", group = "Indicators")
tsi_shrt_len = input.int( 13, title = "TSI Short Length", group = "Indicators")
tsi_ob = input.float( 30, title = "TSI Overbought", group = 'Indicators')
tsi_os = input.float(-30, title = "TSI Oversold", group = 'Indicators')

// ADX Params
adx_smooth = input.int( 14, title = "ADX Smoothing", group = 'Indicators')
adx_dilen = input.int( 14, title = "ADX DI Length", group = 'Indicators')
adx_level = input.float(40, title = "ADX Level", group = 'Indicators')

// SuperTrend
sup_atr_len = input.int( 10, "Supertrend ATR Length", group = 'Indicators')
sup_factor = input.float(3.0, "Supertrend Factor", group = 'Indicators')


/////////////
// SYMBOLS //

u01 = input.bool(true, title = "", group = 'Symbols', inline = 's01')
u02 = input.bool(true, title = "", group = 'Symbols', inline = 's02')
u03 = input.bool(true, title = "", group = 'Symbols', inline = 's03')
u04 = input.bool(true, title = "", group = 'Symbols', inline = 's04')
u05 = input.bool(true, title = "", group = 'Symbols', inline = 's05')
u06 = input.bool(true, title = "", group = 'Symbols', inline = 's06')
u07 = input.bool(true, title = "", group = 'Symbols', inline = 's07')
u08 = input.bool(true, title = "", group = 'Symbols', inline = 's08')
u09 = input.bool(true, title = "", group = 'Symbols', inline = 's09')
u10 = input.bool(true, title = "", group = 'Symbols', inline = 's10')
u11 = input.bool(true, title = "", group = 'Symbols', inline = 's11')
u12 = input.bool(true, title = "", group = 'Symbols', inline = 's12')
u13 = input.bool(true, title = "", group = 'Symbols', inline = 's13')
u14 = input.bool(true, title = "", group = 'Symbols', inline = 's14')
u15 = input.bool(true, title = "", group = 'Symbols', inline = 's15')
u16 = input.bool(true, title = "", group = 'Symbols', inline = 's16')
u17 = input.bool(true, title = "", group = 'Symbols', inline = 's17')
u18 = input.bool(true, title = "", group = 'Symbols', inline = 's18')
u19 = input.bool(true, title = "", group = 'Symbols', inline = 's19')
u20 = input.bool(true, title = "", group = 'Symbols', inline = 's20')
u21 = input.bool(true, title = "", group = 'Symbols', inline = 's21')
u22 = input.bool(true, title = "", group = 'Symbols', inline = 's22')
u23 = input.bool(true, title = "", group = 'Symbols', inline = 's23')
u24 = input.bool(true, title = "", group = 'Symbols', inline = 's24')
u25 = input.bool(true, title = "", group = 'Symbols', inline = 's25')
u26 = input.bool(true, title = "", group = 'Symbols', inline = 's26')
u27 = input.bool(true, title = "", group = 'Symbols', inline = 's27')
u28 = input.bool(true, title = "", group = 'Symbols', inline = 's28')
u29 = input.bool(true, title = "", group = 'Symbols', inline = 's29')
u30 = input.bool(true, title = "", group = 'Symbols', inline = 's30')
u31 = input.bool(true, title = "", group = 'Symbols', inline = 's31')
u32 = input.bool(true, title = "", group = 'Symbols', inline = 's32')
u33 = input.bool(true, title = "", group = 'Symbols', inline = 's33')
u34 = input.bool(true, title = "", group = 'Symbols', inline = 's34')
u35 = input.bool(true, title = "", group = 'Symbols', inline = 's35')
u36 = input.bool(false, title = "", group = 'Symbols', inline = 's36')
u37 = input.bool(false, title = "", group = 'Symbols', inline = 's37')
u38 = input.bool(false, title = "", group = 'Symbols', inline = 's38')
u39 = input.bool(false, title = "", group = 'Symbols', inline = 's39')
u40 = input.bool(false, title = "", group = 'Symbols', inline = 's40')

s01 = input.symbol('SPX500', group = 'Symbols', inline = 's01')
s02 = input.symbol('SPX500', group = 'Symbols', inline = 's02')
s03 = input.symbol('SPX500', group = 'Symbols', inline = 's03')
s04 = input.symbol('SPX500', group = 'Symbols', inline = 's04')
s05 = input.symbol('SPX500', group = 'Symbols', inline = 's05')
s06 = input.symbol('SPX500', group = 'Symbols', inline = 's06')
s07 = input.symbol('SPX500', group = 'Symbols', inline = 's07')
s08 = input.symbol('SPX500', group = 'Symbols', inline = 's08')
s09 = input.symbol('SPX500', group = 'Symbols', inline = 's09')
s10 = input.symbol('SPX500', group = 'Symbols', inline = 's10')
s11 = input.symbol('SPX500', group = 'Symbols', inline = 's11')
s12 = input.symbol('SPX500', group = 'Symbols', inline = 's12')
s13 = input.symbol('SPX500', group = 'Symbols', inline = 's13')
s14 = input.symbol('SPX500', group = 'Symbols', inline = 's14')
s15 = input.symbol('SPX500', group = 'Symbols', inline = 's15')
s16 = input.symbol('SPX500', group = 'Symbols', inline = 's16')
s17 = input.symbol('SPX500', group = 'Symbols', inline = 's17')
s18 = input.symbol('SPX500', group = 'Symbols', inline = 's18')
s19 = input.symbol('SPX500', group = 'Symbols', inline = 's19')
s20 = input.symbol('SPX500', group = 'Symbols', inline = 's20')
s21 = input.symbol('SPX500', group = 'Symbols', inline = 's21')
s22 = input.symbol('SPX500', group = 'Symbols', inline = 's22')
s23 = input.symbol('SPX500', group = 'Symbols', inline = 's23')
s24 = input.symbol('SPX500', group = 'Symbols', inline = 's24')
s25 = input.symbol('SPX500', group = 'Symbols', inline = 's25')
s26 = input.symbol('SPX500', group = 'Symbols', inline = 's26')
s27 = input.symbol('SPX500', group = 'Symbols', inline = 's27')
s28 = input.symbol('SPX500', group = 'Symbols', inline = 's28')
s29 = input.symbol('SPX500', group = 'Symbols', inline = 's29')
s30 = input.symbol('SPX500', group = 'Symbols', inline = 's30')
s31 = input.symbol('SPX500', group = 'Symbols', inline = 's31')
s32 = input.symbol('SPX500', group = 'Symbols', inline = 's32')
s33 = input.symbol('SPX500', group = 'Symbols', inline = 's33')
s34 = input.symbol('SPX500', group = 'Symbols', inline = 's34')
s35 = input.symbol('SPX500', group = 'Symbols', inline = 's35')
s36 = input.symbol('SPX500', group = 'Symbols', inline = 's36')
s37 = input.symbol('SPX500', group = 'Symbols', inline = 's37')
s38 = input.symbol('SPX500', group = 'Symbols', inline = 's38')
s39 = input.symbol('SPX500', group = 'Symbols', inline = 's39')
s40 = input.symbol('SPX500', group = 'Symbols', inline = 's40')

//////////////////
// CALCULATIONS //

// Get only symbol
only_symbol(s) =>
array.get(str.split(s, ":"), 1)

// for TSI
double_smooth(src, long, short) =>
fist_smooth = ta.ema(src, long)
ta.ema(fist_smooth, short)

// ADX
dirmov(len) =>
up = ta.change(high)
down = -ta.change(low)

plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)

truerange = ta.rma(ta.tr, len)

plus = fixnan(100 * ta.rma(plusDM, len) / truerange)
minus = fixnan(100 * ta.rma(minusDM, len) / truerange)

[plus, minus]

adx_func(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

screener_func() =>

// RSI
rsi = ta.rsi(close, rsi_len)

// TSI
pc = ta.change(close)

double_smoothed_pc = double_smooth(pc, tsi_long_len, tsi_shrt_len)
double_smoothed_abs_pc = double_smooth(math.abs(pc), tsi_long_len, tsi_shrt_len)

tsi = 100 * (double_smoothed_pc / double_smoothed_abs_pc)

// ADX
adx = adx_func(adx_dilen, adx_smooth)

// Supertrend
[sup_value, sup_dir] = ta.supertrend(sup_factor, sup_atr_len)

[math.round_to_mintick(close), rsi, tsi, adx, sup_dir]

// Security call
[cl01, rsi01, tsi01, adx01, sup01] = request.security(s01, timeframe.period, screener_func())
[cl02, rsi02, tsi02, adx02, sup02] = request.security(s02, timeframe.period, screener_func())
[cl03, rsi03, tsi03, adx03, sup03] = request.security(s03, timeframe.period, screener_func())
[cl04, rsi04, tsi04, adx04, sup04] = request.security(s04, timeframe.period, screener_func())
[cl05, rsi05, tsi05, adx05, sup05] = request.security(s05, timeframe.period, screener_func())
[cl06, rsi06, tsi06, adx06, sup06] = request.security(s06, timeframe.period, screener_func())
[cl07, rsi07, tsi07, adx07, sup07] = request.security(s07, timeframe.period, screener_func())
[cl08, rsi08, tsi08, adx08, sup08] = request.security(s08, timeframe.period, screener_func())
[cl09, rsi09, tsi09, adx09, sup09] = request.security(s09, timeframe.period, screener_func())
[cl10, rsi10, tsi10, adx10, sup10] = request.security(s10, timeframe.period, screener_func())
[cl11, rsi11, tsi11, adx11, sup11] = request.security(s11, timeframe.period, screener_func())
[cl12, rsi12, tsi12, adx12, sup12] = request.security(s12, timeframe.period, screener_func())
[cl13, rsi13, tsi13, adx13, sup13] = request.security(s13, timeframe.period, screener_func())
[cl14, rsi14, tsi14, adx14, sup14] = request.security(s14, timeframe.period, screener_func())
[cl15, rsi15, tsi15, adx15, sup15] = request.security(s15, timeframe.period, screener_func())
[cl16, rsi16, tsi16, adx16, sup16] = request.security(s16, timeframe.period, screener_func())
[cl17, rsi17, tsi17, adx17, sup17] = request.security(s17, timeframe.period, screener_func())
[cl18, rsi18, tsi18, adx18, sup18] = request.security(s18, timeframe.period, screener_func())
[cl19, rsi19, tsi19, adx19, sup19] = request.security(s19, timeframe.period, screener_func())
[cl20, rsi20, tsi20, adx20, sup20] = request.security(s20, timeframe.period, screener_func())
[cl21, rsi21, tsi21, adx21, sup21] = request.security(s21, timeframe.period, screener_func())
[cl22, rsi22, tsi22, adx22, sup22] = request.security(s22, timeframe.period, screener_func())
[cl23, rsi23, tsi23, adx23, sup23] = request.security(s23, timeframe.period, screener_func())
[cl24, rsi24, tsi24, adx24, sup24] = request.security(s24, timeframe.period, screener_func())
[cl25, rsi25, tsi25, adx25, sup25] = request.security(s25, timeframe.period, screener_func())
[cl26, rsi26, tsi26, adx26, sup26] = request.security(s26, timeframe.period, screener_func())
[cl27, rsi27, tsi27, adx27, sup27] = request.security(s27, timeframe.period, screener_func())
[cl28, rsi28, tsi28, adx28, sup28] = request.security(s28, timeframe.period, screener_func())
[cl29, rsi29, tsi29, adx29, sup29] = request.security(s29, timeframe.period, screener_func())
[cl30, rsi30, tsi30, adx30, sup30] = request.security(s30, timeframe.period, screener_func())
[cl31, rsi31, tsi31, adx31, sup31] = request.security(s31, timeframe.period, screener_func())
[cl32, rsi32, tsi32, adx32, sup32] = request.security(s32, timeframe.period, screener_func())
[cl33, rsi33, tsi33, adx33, sup33] = request.security(s33, timeframe.period, screener_func())
[cl34, rsi34, tsi34, adx34, sup34] = request.security(s34, timeframe.period, screener_func())
[cl35, rsi35, tsi35, adx35, sup35] = request.security(s35, timeframe.period, screener_func())
[cl36, rsi36, tsi36, adx36, sup36] = request.security(s36, timeframe.period, screener_func())
[cl37, rsi37, tsi37, adx37, sup37] = request.security(s37, timeframe.period, screener_func())
[cl38, rsi38, tsi38, adx38, sup38] = request.security(s38, timeframe.period, screener_func())
[cl39, rsi39, tsi39, adx39, sup39] = request.security(s39, timeframe.period, screener_func())
[cl40, rsi40, tsi40, adx40, sup40] = request.security(s40, timeframe.period, screener_func())

////////////
// ARRAYS //

s_arr = array.new_string(0)
u_arr = array.new_bool(0)
cl_arr = array.new_float(0)
rsi_arr = array.new_float(0)
tsi_arr = array.new_float(0)
adx_arr = array.new_float(0)
sup_arr = array.new_float(0)

// Add Symbols
array.push(s_arr, only_symbol(s01))
array.push(s_arr, only_symbol(s02))
array.push(s_arr, only_symbol(s03))
array.push(s_arr, only_symbol(s04))
array.push(s_arr, only_symbol(s05))
array.push(s_arr, only_symbol(s06))
array.push(s_arr, only_symbol(s07))
array.push(s_arr, only_symbol(s08))
array.push(s_arr, only_symbol(s09))
array.push(s_arr, only_symbol(s10))
array.push(s_arr, only_symbol(s11))
array.push(s_arr, only_symbol(s12))
array.push(s_arr, only_symbol(s13))
array.push(s_arr, only_symbol(s14))
array.push(s_arr, only_symbol(s15))
array.push(s_arr, only_symbol(s16))
array.push(s_arr, only_symbol(s17))
array.push(s_arr, only_symbol(s18))
array.push(s_arr, only_symbol(s19))
array.push(s_arr, only_symbol(s20))
array.push(s_arr, only_symbol(s21))
array.push(s_arr, only_symbol(s22))
array.push(s_arr, only_symbol(s23))
array.push(s_arr, only_symbol(s24))
array.push(s_arr, only_symbol(s25))
array.push(s_arr, only_symbol(s26))
array.push(s_arr, only_symbol(s27))
array.push(s_arr, only_symbol(s28))
array.push(s_arr, only_symbol(s29))
array.push(s_arr, only_symbol(s30))
array.push(s_arr, only_symbol(s31))
array.push(s_arr, only_symbol(s32))
array.push(s_arr, only_symbol(s33))
array.push(s_arr, only_symbol(s34))
array.push(s_arr, only_symbol(s35))
array.push(s_arr, only_symbol(s36))
array.push(s_arr, only_symbol(s37))
array.push(s_arr, only_symbol(s38))
array.push(s_arr, only_symbol(s39))
array.push(s_arr, only_symbol(s40))

///////////
// FLAGS //

array.push(u_arr, u01)
array.push(u_arr, u02)
array.push(u_arr, u03)
array.push(u_arr, u04)
array.push(u_arr, u05)
array.push(u_arr, u06)
array.push(u_arr, u07)
array.push(u_arr, u08)
array.push(u_arr, u09)
array.push(u_arr, u10)
array.push(u_arr, u11)
array.push(u_arr, u12)
array.push(u_arr, u13)
array.push(u_arr, u14)
array.push(u_arr, u15)
array.push(u_arr, u16)
array.push(u_arr, u17)
array.push(u_arr, u18)
array.push(u_arr, u19)
array.push(u_arr, u20)
array.push(u_arr, u21)
array.push(u_arr, u22)
array.push(u_arr, u23)
array.push(u_arr, u24)
array.push(u_arr, u25)
array.push(u_arr, u26)
array.push(u_arr, u27)
array.push(u_arr, u28)
array.push(u_arr, u29)
array.push(u_arr, u30)
array.push(u_arr, u31)
array.push(u_arr, u32)
array.push(u_arr, u33)
array.push(u_arr, u34)
array.push(u_arr, u35)
array.push(u_arr, u36)
array.push(u_arr, u37)
array.push(u_arr, u38)
array.push(u_arr, u39)
array.push(u_arr, u40)

///////////
// CLOSE //

array.push(cl_arr, cl01)
array.push(cl_arr, cl02)
array.push(cl_arr, cl03)
array.push(cl_arr, cl04)
array.push(cl_arr, cl05)
array.push(cl_arr, cl06)
array.push(cl_arr, cl07)
array.push(cl_arr, cl08)
array.push(cl_arr, cl09)
array.push(cl_arr, cl10)
array.push(cl_arr, cl11)
array.push(cl_arr, cl12)
array.push(cl_arr, cl13)
array.push(cl_arr, cl14)
array.push(cl_arr, cl15)
array.push(cl_arr, cl16)
array.push(cl_arr, cl17)
array.push(cl_arr, cl18)
array.push(cl_arr, cl19)
array.push(cl_arr, cl20)
array.push(cl_arr, cl21)
array.push(cl_arr, cl22)
array.push(cl_arr, cl23)
array.push(cl_arr, cl24)
array.push(cl_arr, cl25)
array.push(cl_arr, cl26)
array.push(cl_arr, cl27)
array.push(cl_arr, cl28)
array.push(cl_arr, cl29)
array.push(cl_arr, cl30)
array.push(cl_arr, cl31)
array.push(cl_arr, cl32)
array.push(cl_arr, cl33)
array.push(cl_arr, cl34)
array.push(cl_arr, cl35)
array.push(cl_arr, cl36)
array.push(cl_arr, cl37)
array.push(cl_arr, cl38)
array.push(cl_arr, cl39)
array.push(cl_arr, cl40)

/////////
// RSI //

array.push(rsi_arr, rsi01)
array.push(rsi_arr, rsi02)
array.push(rsi_arr, rsi03)
array.push(rsi_arr, rsi04)
array.push(rsi_arr, rsi05)
array.push(rsi_arr, rsi06)
array.push(rsi_arr, rsi07)
array.push(rsi_arr, rsi08)
array.push(rsi_arr, rsi09)
array.push(rsi_arr, rsi10)
array.push(rsi_arr, rsi11)
array.push(rsi_arr, rsi12)
array.push(rsi_arr, rsi13)
array.push(rsi_arr, rsi14)
array.push(rsi_arr, rsi15)
array.push(rsi_arr, rsi16)
array.push(rsi_arr, rsi17)
array.push(rsi_arr, rsi18)
array.push(rsi_arr, rsi19)
array.push(rsi_arr, rsi20)
array.push(rsi_arr, rsi21)
array.push(rsi_arr, rsi22)
array.push(rsi_arr, rsi23)
array.push(rsi_arr, rsi24)
array.push(rsi_arr, rsi25)
array.push(rsi_arr, rsi26)
array.push(rsi_arr, rsi27)
array.push(rsi_arr, rsi28)
array.push(rsi_arr, rsi29)
array.push(rsi_arr, rsi30)
array.push(rsi_arr, rsi31)
array.push(rsi_arr, rsi32)
array.push(rsi_arr, rsi33)
array.push(rsi_arr, rsi34)
array.push(rsi_arr, rsi35)
array.push(rsi_arr, rsi36)
array.push(rsi_arr, rsi37)
array.push(rsi_arr, rsi38)
array.push(rsi_arr, rsi39)
array.push(rsi_arr, rsi40)

/////////
// TSI //

array.push(tsi_arr, tsi01)
array.push(tsi_arr, tsi02)
array.push(tsi_arr, tsi03)
array.push(tsi_arr, tsi04)
array.push(tsi_arr, tsi05)
array.push(tsi_arr, tsi06)
array.push(tsi_arr, tsi07)
array.push(tsi_arr, tsi08)
array.push(tsi_arr, tsi09)
array.push(tsi_arr, tsi10)
array.push(tsi_arr, tsi11)
array.push(tsi_arr, tsi12)
array.push(tsi_arr, tsi13)
array.push(tsi_arr, tsi14)
array.push(tsi_arr, tsi15)
array.push(tsi_arr, tsi16)
array.push(tsi_arr, tsi17)
array.push(tsi_arr, tsi18)
array.push(tsi_arr, tsi19)
array.push(tsi_arr, tsi20)
array.push(tsi_arr, tsi21)
array.push(tsi_arr, tsi22)
array.push(tsi_arr, tsi23)
array.push(tsi_arr, tsi24)
array.push(tsi_arr, tsi25)
array.push(tsi_arr, tsi26)
array.push(tsi_arr, tsi27)
array.push(tsi_arr, tsi28)
array.push(tsi_arr, tsi29)
array.push(tsi_arr, tsi30)
array.push(tsi_arr, tsi31)
array.push(tsi_arr, tsi32)
array.push(tsi_arr, tsi33)
array.push(tsi_arr, tsi34)
array.push(tsi_arr, tsi35)
array.push(tsi_arr, tsi36)
array.push(tsi_arr, tsi37)
array.push(tsi_arr, tsi38)
array.push(tsi_arr, tsi39)
array.push(tsi_arr, tsi40)

/////////
// ADX //

array.push(adx_arr, adx01)
array.push(adx_arr, adx02)
array.push(adx_arr, adx03)
array.push(adx_arr, adx04)
array.push(adx_arr, adx05)
array.push(adx_arr, adx06)
array.push(adx_arr, adx07)
array.push(adx_arr, adx08)
array.push(adx_arr, adx09)
array.push(adx_arr, adx10)
array.push(adx_arr, adx11)
array.push(adx_arr, adx12)
array.push(adx_arr, adx13)
array.push(adx_arr, adx14)
array.push(adx_arr, adx15)
array.push(adx_arr, adx16)
array.push(adx_arr, adx17)
array.push(adx_arr, adx18)
array.push(adx_arr, adx19)
array.push(adx_arr, adx20)
array.push(adx_arr, adx21)
array.push(adx_arr, adx22)
array.push(adx_arr, adx23)
array.push(adx_arr, adx24)
array.push(adx_arr, adx25)
array.push(adx_arr, adx26)
array.push(adx_arr, adx27)
array.push(adx_arr, adx28)
array.push(adx_arr, adx29)
array.push(adx_arr, adx30)
array.push(adx_arr, adx31)
array.push(adx_arr, adx32)
array.push(adx_arr, adx33)
array.push(adx_arr, adx34)
array.push(adx_arr, adx35)
array.push(adx_arr, adx36)
array.push(adx_arr, adx37)
array.push(adx_arr, adx38)
array.push(adx_arr, adx39)
array.push(adx_arr, adx40)

////////////////
// SUPERTREND //

array.push(sup_arr, sup01)
array.push(sup_arr, sup02)
array.push(sup_arr, sup03)
array.push(sup_arr, sup04)
array.push(sup_arr, sup05)
array.push(sup_arr, sup06)
array.push(sup_arr, sup07)
array.push(sup_arr, sup08)
array.push(sup_arr, sup09)
array.push(sup_arr, sup10)
array.push(sup_arr, sup11)
array.push(sup_arr, sup12)
array.push(sup_arr, sup13)
array.push(sup_arr, sup14)
array.push(sup_arr, sup15)
array.push(sup_arr, sup16)
array.push(sup_arr, sup17)
array.push(sup_arr, sup18)
array.push(sup_arr, sup19)
array.push(sup_arr, sup20)
array.push(sup_arr, sup21)
array.push(sup_arr, sup22)
array.push(sup_arr, sup23)
array.push(sup_arr, sup24)
array.push(sup_arr, sup25)
array.push(sup_arr, sup26)
array.push(sup_arr, sup27)
array.push(sup_arr, sup28)
array.push(sup_arr, sup29)
array.push(sup_arr, sup30)
array.push(sup_arr, sup31)
array.push(sup_arr, sup32)
array.push(sup_arr, sup33)
array.push(sup_arr, sup34)
array.push(sup_arr, sup35)
array.push(sup_arr, sup36)
array.push(sup_arr, sup37)
array.push(sup_arr, sup38)
array.push(sup_arr, sup39)
array.push(sup_arr, sup40)

///////////
// PLOTS //

var tbl = table.new(position.top_right, 6, 41, frame_color=#151715, frame_width=2, border_width=2, border_color=color.new(#ffd900, 0))

if barstate.islast

table.cell(tbl, 0, 0, 'Symbol', text_halign = text.align_center, bgcolor = color.rgb(70, 104, 255), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 1, 0, 'Price', text_halign = text.align_center, bgcolor = color.rgb(0,39,76), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 2, 0, 'RSI', text_halign = text.align_center, bgcolor = color.rgb(0,39,76), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 3, 0, 'TSI', text_halign = text.align_center, bgcolor = color.rgb(0,39,76), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 4, 0, 'ADX', text_halign = text.align_center, bgcolor = color.rgb(0,39,76), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 5, 0, 'Supertrend', text_halign = text.align_center, bgcolor = color.rgb(0,39,76), text_color = color.new(#ffd900, 0), text_size = size.small)

for i = 0 to 39
if array.get(u_arr, i)

rsi_col = array.get(rsi_arr, i) > rsi_ob ? color.red : array.get(rsi_arr, i) < rsi_os ? color.green : #000000
tsi_col = array.get(tsi_arr, i) > tsi_ob ? color.red : array.get(tsi_arr, i) < tsi_os ? color.green : #000000
adx_col = array.get(adx_arr, i) > adx_level ? color.green : #000000

sup_text = array.get(sup_arr, i) > 0 ? "Down" : "Up"
sup_col = array.get(sup_arr, i) > 0 ? color.green : color.rgb(255, 0, 0)

table.cell(tbl, 0, i + 1, array.get(s_arr, i), text_halign = text.align_left, bgcolor = color.rgb(70, 104, 255), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 1, i + 1, str.tostring(array.get(cl_arr, i)), text_halign = text.align_center, bgcolor = color.rgb(0, 0, 0), text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 2, i + 1, str.tostring(array.get(rsi_arr, i), "#.##"), text_halign = text.align_center, bgcolor = rsi_col, text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 3, i + 1, str.tostring(array.get(tsi_arr, i), "#.##"), text_halign = text.align_center, bgcolor = tsi_col, text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 4, i + 1, str.tostring(array.get(adx_arr, i), "#.##"), text_halign = text.align_center, bgcolor = adx_col , text_color = color.new(#ffd900, 0), text_size = size.small)
table.cell(tbl, 5, i + 1, sup_text, text_halign = text.align_center, bgcolor = sup_col, text_color = color.new(#ffffff, 0), text_size = size.small)
Technical Indicators

כתב ויתור