Didi's Needles setup screener 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @Heeger
// Apenas um rapaz latino americano

//@version=5
indicator('Didi Screener V1', overlay=true)

////////////
// INPUTS //
 
// MA Type \\
ma(source, length, type) =>
    switch type
        "SMA" => ta.sma(source, length)
        "EMA" => ta.ema(source, length)
        "RMA (SMMA)" => ta.rma(source, length)
		"HMA" => ta.hma(source, length)
        "WMA" => ta.wma(source, length)
        "VWMA" => ta.vwma(source, length)

// ADX (Code Original by Smollet) \\
adxlen = input(8, title="ADX Smoothing", group = "ADX Config", inline = "Adx")
dilen = input(8, title="DI Length", group = "ADX Config", inline = "Adx")
level = input(32, title = "Level", group = "ADX Config", inline = "Adx")
maTypeInputDM = input.string("RMA (SMMA)", title="+DM -DM MA Settings", options=["SMA", "EMA", "RMA (SMMA)", "HMA", "WMA", "VWMA"], group="ADX MA Type")
maTypeInputADX = input.string("WMA", title="ADX Smoothing Settings", options=["SMA", "EMA", "RMA (SMMA)", "HMA", "WMA", "VWMA"], group="ADX MA Type")

// DIDI Index Inputs \\
ddfast = input.int(title="Fast average", defval=3, group="Didi index config")
ddmedian = input.int(title="Normal average", defval=8, group="Didi index config")
ddslow = input.int(title="Slow average", defval=20, group="Didi index config")
maTypeInputDidi = input.string("SMA", title="MA Type", options=["SMA", "EMA", "RMA (SMMA)", "HMA", "WMA", "VWMA"], group="Didi index config")

delta = input.int(3, title = "Delta t Needle", group = "Agulhada", tooltip = "Defina o delta tempo entre o alerta e confirmação para considerar a agulhada.")

deltaBJmin = input.float(0.02, step=0.01, title = "Delta BJMA Min", group = "Beijo da Mulher Aranha")
deltaBJmax = input.float(0.05, step=0.01, title = "Delta BJMA Max", group = "Beijo da Mulher Aranha")

// BB Inputs //
length = input.int(8, minval=1, group = "Bollinger Bands", inline = "BB")
src = input(close, title="Source", group = "Bollinger Bands", inline = "BB")
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev", group = "Bollinger Bands", inline = "BB")
offset = input.int(0, "Offset", minval = -500, maxval = 500, group = "Bollinger Bands", inline = "BB")

// Trix Inputs //
trixLen = input.int(9, title="TRIX Length", minval=1, group  = "Trix", inline = "trix")
maLen = input.int(4, title="Moving Average", minval=1, group  = "Trix", inline = "trix")
useEma = input.bool(false, title="Use Ema ?", group  = "Trix", inline = "trix")

// Stoch //
periodK = input.int(8, title="%K Length", minval=1, group = "Stoch", inline = "stoch")
smoothK = input.int(3, title="%K Smoothing", minval=1, group = "Stoch", inline = "stoch")
periodD = input.int(3, title="%D Smoothing", minval=1, group = "Stoch", inline = "stoch")

// Table Inputs //
col_width = input.float(5, title = "Column Width (%)", group = "Table Config")
scr_numb  = input.int(1, title = "Screen #", tooltip = '1 - rightmost screener', minval = 1, group = "Table Config")

// Colors Inputs //
bgLong1 = input.color(color.new(#2C4C78, 0), title = "Color Background Long 1", inline = "Color Background Long", group = "Color Background Long")
bgLong2 = input.color(color.new(#376099, 0), title = "Color Background Long 2", inline = "Color Background Long", group = "Color Background Long")
bgLong3 = input.color(color.new(#467ecc, 0), title = "Color Background Long 3", inline = "Color Background Long", group = "Color Background Long")
bgLong4 = input.color(color.new(#4b8be6, 0), title = "Color Background Long 4", inline = "Color Background Long", group = "Color Background Long")
bgLong5 = input.color(color.new(#519aff, 0), title = "Color Background Long 5", inline = "Color Background Long", group = "Color Background Long")
bgShort1 = input.color(color.new(#776f29, 0), title = "Color Background Short 1", inline = "Color Background Short", group = "Color Background Short")
bgShort2 = input.color(color.new(#918836, 0), title = "Color Background Short 2", inline = "Color Background Short", group = "Color Background Short")
bgShort3 = input.color(color.new(#a89d36, 0), title = "Color Background Short 3", inline = "Color Background Short", group = "Color Background Short")
bgShort4 = input.color(color.new(#c0b236, 0), title = "Color Background Short 4", inline = "Color Background Short", group = "Color Background Short")
bgShort5 = input.color(color.new(#e2d240, 0), title = "Color Background Short 5", inline = "Color Background Short", group = "Color Background Short")
bgCloseLong = input.color(#aa2b2b, title = "Color Background Close Long", inline = "Color Background Close Buy", group = "Color Background Close")
bgCloseShort = input.color(#aa2b2b, title = "Color Background Close Short", inline = "Color Background Close Short", group = "Color Background Close")

/////////////
// 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(true, title = "", group = 'Symbols', inline = 's36')
u37 = input.bool(true, title = "", group = 'Symbols', inline = 's37')
u38 = input.bool(true, title = "", group = 'Symbols', inline = 's38')
u39 = input.bool(true, title = "", group = 'Symbols', inline = 's39')
u40 = input.bool(true, title = "", group = 'Symbols', inline = 's40')

s01 = input.symbol("BMFBOVESPA:WDO1!",  group = 'Symbols', inline = 's01')
s02 = input.symbol("PEPPERSTONE:BTCUSD",  group = 'Symbols', inline = 's02')
s03 = input.symbol("TVC:GOLD",  group = 'Symbols', inline = 's03')
s04 = input.symbol("FX:EURUSD",  group = 'Symbols', inline = 's04')
s05 = input.symbol("FX:USDJPY",  group = 'Symbols', inline = 's05')
s06 = input.symbol("FX:GBPUSD",  group = 'Symbols', inline = 's06')
s07 = input.symbol("FX:USDCAD",  group = 'Symbols', inline = 's07')
s08 = input.symbol("FX:USDSEK",  group = 'Symbols', inline = 's08')
s09 = input.symbol("FX:USDCHF",  group = 'Symbols', inline = 's09')
s10 = input.symbol("FX:EURGBP",  group = 'Symbols', inline = 's10')
s11 = input.symbol("FX:GBPJPY",  group = 'Symbols', inline = 's11')
s12 = input.symbol("FX:GBPAUD",  group = 'Symbols', inline = 's12')
s13 = input.symbol("FX:AUDCAD",  group = 'Symbols', inline = 's13')
s14 = input.symbol("PEPPERSTONE:USDSGD",  group = 'Symbols', inline = 's14')
s15 = input.symbol("FX:NZDUSD",  group = 'Symbols', inline = 's15')
s16 = input.symbol("FX:AUDUSD",  group = 'Symbols', inline = 's16')
s17 = input.symbol("FX:EURAUD",  group = 'Symbols', inline = 's17')
s18 = input.symbol("FX:EURCAD",  group = 'Symbols', inline = 's18')
s19 = input.symbol("FX:EURCHF",  group = 'Symbols', inline = 's19')
s20 = input.symbol("FX:EURJPY",  group = 'Symbols', inline = 's20')
s21 = input.symbol("FX:EURNZD",  group = 'Symbols', inline = 's21')
s22 = input.symbol("FX:GBPCAD",  group = 'Symbols', inline = 's22')
s23 = input.symbol("FX:GBPCHF",  group = 'Symbols', inline = 's23')
s24 = input.symbol("FX:GBPNZD",  group = 'Symbols', inline = 's24')
s25 = input.symbol("FX:AUDCHF",  group = 'Symbols', inline = 's25')
s26 = input.symbol("FX:AUDNZD",  group = 'Symbols', inline = 's26')
s27 = input.symbol("FX:CADJPY",  group = 'Symbols', inline = 's27')
s28 = input.symbol("FX:CADCHF",  group = 'Symbols', inline = 's28')
s29 = input.symbol("FX:NZDCAD",  group = 'Symbols', inline = 's29')
s30 = input.symbol("FX:CHFJPY",  group = 'Symbols', inline = 's30')
s31 = input.symbol("FX:NZDCHF",  group = 'Symbols', inline = 's31')
s32 = input.symbol("FX:NZDJPY",  group = 'Symbols', inline = 's32')
s33 = input.symbol("FX:AUDJPY",  group = 'Symbols', inline = 's33')
s34 = input.symbol("FX:USDNOK",  group = 'Symbols', inline = 's34')
s35 = input.symbol("FOREXCOM:USDPLN",  group = 'Symbols', inline = 's35')
s36 = input.symbol("FX:USDMXN",  group = 'Symbols', inline = 's36')
s37 = input.symbol("FOREXCOM:EURMXN",  group = 'Symbols', inline = 's37')
s38 = input.symbol("FX:EURNOK",  group = 'Symbols', inline = 's38')
s39 = input.symbol("FOREXCOM:EURSGD",  group = 'Symbols', inline = 's39')
s40 = input.symbol("FOREXCOM:SGDJPY",  group = 'Symbols', inline = 's40')

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

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

// ADX CALCULATION //
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 = ma(ta.tr, len, maTypeInputDM)
	plus = fixnan(100 * ma(plusDM, len, maTypeInputDM) / truerange)
	minus = fixnan(100 * ma(minusDM, len, maTypeInputDM) / truerange)
	[plus, minus]

adx(dilen, adxlen) =>
	[plus, minus] = dirmov(dilen)
	sum = plus + minus
	dx = 100* math.abs(plus - minus) / (sum == 0 ? 1 : sum)
	adx = ma(dx, adxlen, maTypeInputADX)
	adxxr = (adx+adx[adxlen])/2
	[adx, dx, plus, minus, adxxr]

[sig, dxx, diplus, diminus, adxr] = adx(dilen, adxlen)

// DIDI INDEX CALCULATIONS \\
DidiSlow = (ma(close, ddslow, maTypeInputDidi) / ma(close, ddmedian, maTypeInputDidi) - 1) * 100
DidiFast = (ma(close, ddfast, maTypeInputDidi) / ma(close, ddmedian, maTypeInputDidi) - 1) * 100
DidiMedian = (close / ma(close, ddmedian, maTypeInputDidi) - 1) * 100

// BB CALCULATIONS //
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev

// Trix Calculations //
trix = 10000 * ta.change(ta.ema(ta.ema(ta.ema(math.log(close), trixLen), trixLen), trixLen))

ema = ta.ema(trix, maLen)
sma = ta.sma(trix, maLen)

maTrix = useEma ? ema : sma

// Stoch Calculations //
k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
d = ta.sma(k, periodD)

///////////
// PLOT //

screener_func() =>
    
    // ADX \\
    adxTrendUp = diplus > diminus and sig >= sig[1] and sig < level and sig > diminus
    adxTrendUpStrong = diplus > diminus and sig >= sig[1] and sig >= level
    adxTrendUpFalling = diplus > diminus and sig < sig[1] and sig >= level
    adxTrendDown = diminus > diplus and sig > sig[1] and sig < level and sig > diplus
    adxTrendDownStrong = diminus > diplus and sig > sig[1] and sig >= level
    adxTrendDownFalling = diminus > diplus and sig <= sig[1] and sig >= level
    //ADX KICK
    adxKick = sig <= sig[1] and sig[1] >= sig[2] and sig >= level

    // Didi Index \\
    // Alerts
    longaUp = DidiSlow > DidiSlow[1]
    longaNeutral = DidiSlow == DidiSlow[1]
    longaDown = DidiSlow < DidiSlow[1]
    curtaUp = DidiFast > DidiFast[1]
    curtaDown = DidiFast < DidiFast[1]
    alertaCompra = ta.crossover(DidiFast, 0)
    alertaVenda = ta.crossunder(DidiFast, 0)
    confirmaCompra = ta.crossunder(DidiSlow, 0)
    confirmaVenda = ta.crossover(DidiSlow, 0)

    alertVendaF = alertaVenda and DidiSlow < 0 and longaUp
    alertCompraF = alertaCompra and DidiSlow > 0 and longaDown
    alertVendaFC = DidiSlow < 0 and longaUp and DidiFast < 0
    alertCompraFC = DidiSlow > 0 and longaDown and DidiFast < 0

    // Fake long and short
    compraFalsa = alertaCompra and longaUp and DidiSlow > DidiFast 
    vendaFalsa = alertaVenda  and longaDown and DidiSlow < DidiFast 

    // Needle conditions
    // Delta needles
    barAlertaCompra = ta.barssince(alertaCompra)
    barConfirmaCompra = ta.barssince(confirmaCompra)
    barAlertaVenda = ta.barssince(alertaVenda)
    barConfirmaVenda = ta.barssince(confirmaVenda)

    barNeedleCompra = barAlertaCompra + barConfirmaCompra + 1
    barNeedleVenda = barAlertaVenda + barConfirmaVenda + 1

    // Direction of needles
    didiComprado = DidiFast > 0 and DidiSlow < 0
    didiVendido = DidiFast < 0 and DidiSlow > 0

    // Needles
    agulhadaCompra = barNeedleCompra <= delta and barNeedleCompra >= 0
    agulhadaVenda = barNeedleVenda <= delta and barNeedleVenda >= 0

    // BJMA
    bjCompraMax = didiComprado and didiComprado[1] == true and curtaUp and longaDown and DidiFast <= deltaBJmax and (DidiSlow >= deltaBJmax - deltaBJmax * 2)
    bjCompraMin = didiComprado and didiComprado[1] == true and curtaUp and longaDown and DidiFast[1] <= deltaBJmin and (DidiSlow[1] >= deltaBJmin - deltaBJmin * 2)
    bjCompra = bjCompraMax and bjCompraMin

    bjVendaMax = didiVendido and didiVendido[1] == true and longaUp and curtaDown and DidiSlow <= deltaBJmax and (DidiFast >= deltaBJmax - deltaBJmax * 2) 
    bjVendaMin = didiVendido and didiVendido[1] == true and longaUp and curtaDown and DidiSlow[1] <= deltaBJmin and (DidiFast[1] >= deltaBJmin - deltaBJmin * 2) 
    bjVenda = bjVendaMax and bjVendaMin

    // Bollinger Bands \\
    bbOpenUp = upper > upper[1] and lower < lower[1] and basis > basis[1]
    bbOpenDown = upper > upper[1] and lower < lower[1] and basis < basis[1]
    bbParallelUp = upper > upper[1] and (lower > lower[1] or lower == lower[1])
    bbParallelDown = (upper < upper[1] or upper == upper[1]) and lower < lower[1]
    bbClose = upper <= upper[1] and lower >= lower[1]

    // Trix \\
    trixUp = trix > maTrix
    trixDown = trix < maTrix 

    // Stoch \\
    stochDown = d > k
    stochUp = k > d

    // Sybmbol Screener \\
    symbolDidi = switch
        (bbOpenUp or bbParallelUp) and (adxTrendUp or adxTrendUpStrong or adxTrendUpFalling) and agulhadaCompra and (agulhadaCompra[1] == false and didiComprado[1] == false) => "Needle Buy"
        (bbOpenDown or bbParallelDown) and (adxTrendDown or adxTrendDownStrong or adxTrendDownFalling) and agulhadaVenda and (agulhadaVenda[1] == false and didiVendido[1] == false) => "Needle Sell"

        (bbOpenUp or bbParallelUp) and (adxTrendUp or adxTrendUpStrong or adxTrendUpFalling) and bjCompra and (bjCompra[1] == false and agulhadaCompra[1] == false) => "BJMA Buy"
        (bbOpenDown or bbParallelDown) and (adxTrendDown or adxTrendDownStrong or adxTrendDownFalling) and bjVenda and (bjVenda[1] == false and agulhadaVenda[1] == false) => "BJMA Sell"

        (bbOpenUp or bbParallelUp) and (adxTrendUp or adxTrendUpStrong or adxTrendUpFalling) and (alertCompraF or alertCompraFC) => "Buy Alert"

        (bbOpenDown or bbParallelDown) and (adxTrendDown or adxTrendDownStrong or adxTrendDownFalling) and (alertVendaF or alertVendaFC) => "Sell Alert"

        (bbOpenUp or bbParallelUp) and (adxTrendUp or adxTrendUpStrong or adxTrendUpFalling) and didiComprado => "Bought"

        (bbOpenDown or bbParallelDown) and (adxTrendDown or adxTrendDownStrong or adxTrendDownFalling) and didiVendido => "Sold"

        bbClose and (adxKick or adxTrendUpFalling) and didiComprado and trixDown and stochDown => "Close Long"
        bbClose and (adxKick or adxTrendDownFalling) and didiVendido and trixUp and stochUp => "Close Short"
        (adxTrendDown or adxTrendDownStrong or adxTrendDownFalling) and (alertVendaF or alertVendaFC) => "Close Long - Sell Alert"
        (adxTrendUp or adxTrendUpStrong or adxTrendUpFalling) and (alertCompraF or alertCompraFC) => "Close Short - Buy Alert"

        vendaFalsa => "Fake Sell"
        compraFalsa => "Fake Buy"

        => ""

    // Didi Result Screener
    didi = switch
    // Alert 
        alertCompraF => "Buy Alert"
        alertVendaF => "Sell Alert"
    // Needles
        agulhadaCompra => "Needle Buy"
        agulhadaVenda => "Needle Sell"
    // Side Didi 
        didiComprado => "Bought"
        didiVendido => "Sold"
    // PF Didi
        vendaFalsa => "Fake Sell"
        compraFalsa =>"Fake Buy"
        => ""
        
    // Stoch Screener
    StochDidi = switch
        stochDown => "Sold"
        stochUp => "Bought"

    // Trix Screener
    trixdidi = switch
        trixUp => "Bought"
        trixDown => "Sold"

    // Bollinger Bands Screener
    bb = switch
        bbOpenUp => "Open Rising"
        bbOpenDown => "Open Falling"
        bbParallelUp => "Parallel Rising"
        bbParallelDown => "Parallel Falling"
        => "Close"

    // ADX Result Screener
    adxd = switch
        adxTrendUp => "Uptrend"
        adxTrendUpStrong => "Uptrend Strong"
        adxTrendUpFalling => "Uptrend Falling"
        adxTrendDown => "Downtrend"
        adxTrendDownStrong => "Downtrend Strong"
        adxTrendDownFalling => "Downtrend Falling"
        adxKick => "Kick ADX"

    [symbolDidi,adxd, didi, bb, trixdidi, StochDidi]

// Security call
[symboldidi01, adxd01, didi01, bb01, trixdidi01, stochDidi01] = request.security(s01, timeframe.period, screener_func())
[symboldidi02, adxd02, didi02, bb02, trixdidi02, stochDidi02] = request.security(s02, timeframe.period, screener_func())
[symboldidi03, adxd03, didi03, bb03, trixdidi03, stochDidi03] = request.security(s03, timeframe.period, screener_func())
[symboldidi04, adxd04, didi04, bb04, trixdidi04, stochDidi04] = request.security(s04, timeframe.period, screener_func())
[symboldidi05, adxd05, didi05, bb05, trixdidi05, stochDidi05] = request.security(s05, timeframe.period, screener_func())
[symboldidi06, adxd06, didi06, bb06, trixdidi06, stochDidi06] = request.security(s06, timeframe.period, screener_func())
[symboldidi07, adxd07, didi07, bb07, trixdidi07, stochDidi07] = request.security(s07, timeframe.period, screener_func())
[symboldidi08, adxd08, didi08, bb08, trixdidi08, stochDidi08] = request.security(s08, timeframe.period, screener_func())
[symboldidi09, adxd09, didi09, bb09, trixdidi09, stochDidi09] = request.security(s09, timeframe.period, screener_func())
[symboldidi10, adxd10, didi10, bb10, trixdidi10, stochDidi10] = request.security(s10, timeframe.period, screener_func())
[symboldidi11, adxd11, didi11, bb11, trixdidi11, stochDidi11] = request.security(s11, timeframe.period, screener_func())
[symboldidi12, adxd12, didi12, bb12, trixdidi12, stochDidi12] = request.security(s12, timeframe.period, screener_func())
[symboldidi13, adxd13, didi13, bb13, trixdidi13, stochDidi13] = request.security(s13, timeframe.period, screener_func())
[symboldidi14, adxd14, didi14, bb14, trixdidi14, stochDidi14] = request.security(s14, timeframe.period, screener_func())
[symboldidi15, adxd15, didi15, bb15, trixdidi15, stochDidi15] = request.security(s15, timeframe.period, screener_func())
[symboldidi16, adxd16, didi16, bb16, trixdidi16, stochDidi16] = request.security(s16, timeframe.period, screener_func())
[symboldidi17, adxd17, didi17, bb17, trixdidi17, stochDidi17] = request.security(s17, timeframe.period, screener_func())
[symboldidi18, adxd18, didi18, bb18, trixdidi18, stochDidi18] = request.security(s18, timeframe.period, screener_func())
[symboldidi19, adxd19, didi19, bb19, trixdidi19, stochDidi19] = request.security(s19, timeframe.period, screener_func())
[symboldidi20, adxd20, didi20, bb20, trixdidi20, stochDidi20] = request.security(s20, timeframe.period, screener_func())
[symboldidi21, adxd21, didi21, bb21, trixdidi21, stochDidi21] = request.security(s21, timeframe.period, screener_func())
[symboldidi22, adxd22, didi22, bb22, trixdidi22, stochDidi22] = request.security(s22, timeframe.period, screener_func())
[symboldidi23, adxd23, didi23, bb23, trixdidi23, stochDidi23] = request.security(s23, timeframe.period, screener_func())
[symboldidi24, adxd24, didi24, bb24, trixdidi24, stochDidi24] = request.security(s24, timeframe.period, screener_func())
[symboldidi25, adxd25, didi25, bb25, trixdidi25, stochDidi25] = request.security(s25, timeframe.period, screener_func())
[symboldidi26, adxd26, didi26, bb26, trixdidi26, stochDidi26] = request.security(s26, timeframe.period, screener_func())
[symboldidi27, adxd27, didi27, bb27, trixdidi27, stochDidi27] = request.security(s27, timeframe.period, screener_func())
[symboldidi28, adxd28, didi28, bb28, trixdidi28, stochDidi28] = request.security(s28, timeframe.period, screener_func())
[symboldidi29, adxd29, didi29, bb29, trixdidi29, stochDidi29] = request.security(s29, timeframe.period, screener_func())
[symboldidi30, adxd30, didi30, bb30, trixdidi30, stochDidi30] = request.security(s30, timeframe.period, screener_func())
[symboldidi31, adxd31, didi31, bb31, trixdidi31, stochDidi31] = request.security(s31, timeframe.period, screener_func())
[symboldidi32, adxd32, didi32, bb32, trixdidi32, stochDidi32] = request.security(s32, timeframe.period, screener_func())
[symboldidi33, adxd33, didi33, bb33, trixdidi33, stochDidi33] = request.security(s33, timeframe.period, screener_func())
[symboldidi34, adxd34, didi34, bb34, trixdidi34, stochDidi34] = request.security(s34, timeframe.period, screener_func())
[symboldidi35, adxd35, didi35, bb35, trixdidi35, stochDidi35] = request.security(s35, timeframe.period, screener_func())
[symboldidi36, adxd36, didi36, bb36, trixdidi36, stochDidi36] = request.security(s36, timeframe.period, screener_func())
[symboldidi37, adxd37, didi37, bb37, trixdidi37, stochDidi37] = request.security(s37, timeframe.period, screener_func())
[symboldidi38, adxd38, didi38, bb38, trixdidi38, stochDidi38] = request.security(s38, timeframe.period, screener_func())
[symboldidi39, adxd39, didi39, bb39, trixdidi39, stochDidi39] = request.security(s39, timeframe.period, screener_func())
[symboldidi40, adxd40, didi40, bb40, trixdidi40, stochDidi40] = request.security(s40, timeframe.period, screener_func())

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

p_arr   = array.new_string(0)
s_arr   = array.new_string(0)
u_arr   = array.new_bool(0)
rsi_arr = array.new_float(0)
didi_arr = array.new_string(0)
adxd_arr = array.new_string(0)
bb_arr = array.new_string(0)
trixdidi_arr = array.new_string(0)
stocchdidi_arr = array.new_string(0)
symboldidi_arr = array.new_string(0)

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

// 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)


// Symbol Color
array.push(symboldidi_arr, symboldidi01)
array.push(symboldidi_arr, symboldidi02)
array.push(symboldidi_arr, symboldidi03)
array.push(symboldidi_arr, symboldidi04)
array.push(symboldidi_arr, symboldidi05)
array.push(symboldidi_arr, symboldidi06)
array.push(symboldidi_arr, symboldidi07)
array.push(symboldidi_arr, symboldidi08)
array.push(symboldidi_arr, symboldidi09)
array.push(symboldidi_arr, symboldidi10)
array.push(symboldidi_arr, symboldidi11)
array.push(symboldidi_arr, symboldidi12)
array.push(symboldidi_arr, symboldidi13)
array.push(symboldidi_arr, symboldidi14)
array.push(symboldidi_arr, symboldidi15)
array.push(symboldidi_arr, symboldidi16)
array.push(symboldidi_arr, symboldidi17)
array.push(symboldidi_arr, symboldidi18)
array.push(symboldidi_arr, symboldidi19)
array.push(symboldidi_arr, symboldidi20)
array.push(symboldidi_arr, symboldidi21)
array.push(symboldidi_arr, symboldidi22)
array.push(symboldidi_arr, symboldidi23)
array.push(symboldidi_arr, symboldidi24)
array.push(symboldidi_arr, symboldidi25)
array.push(symboldidi_arr, symboldidi26)
array.push(symboldidi_arr, symboldidi27)
array.push(symboldidi_arr, symboldidi28)
array.push(symboldidi_arr, symboldidi29)
array.push(symboldidi_arr, symboldidi30)
array.push(symboldidi_arr, symboldidi31)
array.push(symboldidi_arr, symboldidi32)
array.push(symboldidi_arr, symboldidi33)
array.push(symboldidi_arr, symboldidi34)
array.push(symboldidi_arr, symboldidi35)
array.push(symboldidi_arr, symboldidi36)
array.push(symboldidi_arr, symboldidi37)
array.push(symboldidi_arr, symboldidi38)
array.push(symboldidi_arr, symboldidi39)
array.push(symboldidi_arr, symboldidi40)

// ADX
array.push(adxd_arr, adxd01)
array.push(adxd_arr, adxd02)
array.push(adxd_arr, adxd03)
array.push(adxd_arr, adxd04)
array.push(adxd_arr, adxd05)
array.push(adxd_arr, adxd06)
array.push(adxd_arr, adxd07)
array.push(adxd_arr, adxd08)
array.push(adxd_arr, adxd09)
array.push(adxd_arr, adxd10)
array.push(adxd_arr, adxd11)
array.push(adxd_arr, adxd12)
array.push(adxd_arr, adxd13)
array.push(adxd_arr, adxd14)
array.push(adxd_arr, adxd15)
array.push(adxd_arr, adxd16)
array.push(adxd_arr, adxd17)
array.push(adxd_arr, adxd18)
array.push(adxd_arr, adxd19)
array.push(adxd_arr, adxd20)
array.push(adxd_arr, adxd21)
array.push(adxd_arr, adxd22)
array.push(adxd_arr, adxd23)
array.push(adxd_arr, adxd24)
array.push(adxd_arr, adxd25)
array.push(adxd_arr, adxd26)
array.push(adxd_arr, adxd27)
array.push(adxd_arr, adxd28)
array.push(adxd_arr, adxd29)
array.push(adxd_arr, adxd30)
array.push(adxd_arr, adxd31)
array.push(adxd_arr, adxd32)
array.push(adxd_arr, adxd33)
array.push(adxd_arr, adxd34)
array.push(adxd_arr, adxd35)
array.push(adxd_arr, adxd36)
array.push(adxd_arr, adxd37)
array.push(adxd_arr, adxd38)
array.push(adxd_arr, adxd39)
array.push(adxd_arr, adxd40)

// Didi index
array.push(didi_arr, didi01)
array.push(didi_arr, didi02)
array.push(didi_arr, didi03)
array.push(didi_arr, didi04)
array.push(didi_arr, didi05)
array.push(didi_arr, didi06)
array.push(didi_arr, didi07)
array.push(didi_arr, didi08)
array.push(didi_arr, didi09)
array.push(didi_arr, didi10)
array.push(didi_arr, didi11)
array.push(didi_arr, didi12)
array.push(didi_arr, didi13)
array.push(didi_arr, didi14)
array.push(didi_arr, didi15)
array.push(didi_arr, didi16)
array.push(didi_arr, didi17)
array.push(didi_arr, didi18)
array.push(didi_arr, didi19)
array.push(didi_arr, didi20)
array.push(didi_arr, didi21)
array.push(didi_arr, didi22)
array.push(didi_arr, didi23)
array.push(didi_arr, didi24)
array.push(didi_arr, didi25)
array.push(didi_arr, didi26)
array.push(didi_arr, didi27)
array.push(didi_arr, didi28)
array.push(didi_arr, didi29)
array.push(didi_arr, didi30)
array.push(didi_arr, didi31)
array.push(didi_arr, didi32)
array.push(didi_arr, didi33)
array.push(didi_arr, didi34)
array.push(didi_arr, didi35)
array.push(didi_arr, didi36)
array.push(didi_arr, didi37)
array.push(didi_arr, didi38)
array.push(didi_arr, didi39)
array.push(didi_arr, didi40)

// Bollinger Bands
array.push(bb_arr, bb01)
array.push(bb_arr, bb02)
array.push(bb_arr, bb03)
array.push(bb_arr, bb04)
array.push(bb_arr, bb05)
array.push(bb_arr, bb06)
array.push(bb_arr, bb07)
array.push(bb_arr, bb08)
array.push(bb_arr, bb09)
array.push(bb_arr, bb10)
array.push(bb_arr, bb11)
array.push(bb_arr, bb12)
array.push(bb_arr, bb13)
array.push(bb_arr, bb14)
array.push(bb_arr, bb15)
array.push(bb_arr, bb16)
array.push(bb_arr, bb17)
array.push(bb_arr, bb18)
array.push(bb_arr, bb19)
array.push(bb_arr, bb20)
array.push(bb_arr, bb21)
array.push(bb_arr, bb22)
array.push(bb_arr, bb23)
array.push(bb_arr, bb24)
array.push(bb_arr, bb25)
array.push(bb_arr, bb26)
array.push(bb_arr, bb27)
array.push(bb_arr, bb28)
array.push(bb_arr, bb29)
array.push(bb_arr, bb30)
array.push(bb_arr, bb31)
array.push(bb_arr, bb32)
array.push(bb_arr, bb33)
array.push(bb_arr, bb34)
array.push(bb_arr, bb35)
array.push(bb_arr, bb36)
array.push(bb_arr, bb37)
array.push(bb_arr, bb38)
array.push(bb_arr, bb39)
array.push(bb_arr, bb40)

// Trix
array.push(trixdidi_arr, trixdidi01)
array.push(trixdidi_arr, trixdidi02)
array.push(trixdidi_arr, trixdidi03)
array.push(trixdidi_arr, trixdidi04)
array.push(trixdidi_arr, trixdidi05)
array.push(trixdidi_arr, trixdidi06)
array.push(trixdidi_arr, trixdidi07)
array.push(trixdidi_arr, trixdidi08)
array.push(trixdidi_arr, trixdidi09)
array.push(trixdidi_arr, trixdidi10)
array.push(trixdidi_arr, trixdidi11)
array.push(trixdidi_arr, trixdidi12)
array.push(trixdidi_arr, trixdidi13)
array.push(trixdidi_arr, trixdidi14)
array.push(trixdidi_arr, trixdidi15)
array.push(trixdidi_arr, trixdidi16)
array.push(trixdidi_arr, trixdidi17)
array.push(trixdidi_arr, trixdidi18)
array.push(trixdidi_arr, trixdidi19)
array.push(trixdidi_arr, trixdidi20)
array.push(trixdidi_arr, trixdidi21)
array.push(trixdidi_arr, trixdidi22)
array.push(trixdidi_arr, trixdidi23)
array.push(trixdidi_arr, trixdidi24)
array.push(trixdidi_arr, trixdidi25)
array.push(trixdidi_arr, trixdidi26)
array.push(trixdidi_arr, trixdidi27)
array.push(trixdidi_arr, trixdidi28)
array.push(trixdidi_arr, trixdidi29)
array.push(trixdidi_arr, trixdidi30)
array.push(trixdidi_arr, trixdidi31)
array.push(trixdidi_arr, trixdidi32)
array.push(trixdidi_arr, trixdidi33)
array.push(trixdidi_arr, trixdidi34)
array.push(trixdidi_arr, trixdidi35)
array.push(trixdidi_arr, trixdidi36)
array.push(trixdidi_arr, trixdidi37)
array.push(trixdidi_arr, trixdidi38)
array.push(trixdidi_arr, trixdidi39)
array.push(trixdidi_arr, trixdidi40)

// Stoch
array.push(stocchdidi_arr, stochDidi01)
array.push(stocchdidi_arr, stochDidi02)
array.push(stocchdidi_arr, stochDidi03)
array.push(stocchdidi_arr, stochDidi04)
array.push(stocchdidi_arr, stochDidi05)
array.push(stocchdidi_arr, stochDidi06)
array.push(stocchdidi_arr, stochDidi07)
array.push(stocchdidi_arr, stochDidi08)
array.push(stocchdidi_arr, stochDidi09)
array.push(stocchdidi_arr, stochDidi10)
array.push(stocchdidi_arr, stochDidi11)
array.push(stocchdidi_arr, stochDidi12)
array.push(stocchdidi_arr, stochDidi13)
array.push(stocchdidi_arr, stochDidi14)
array.push(stocchdidi_arr, stochDidi15)
array.push(stocchdidi_arr, stochDidi16)
array.push(stocchdidi_arr, stochDidi17)
array.push(stocchdidi_arr, stochDidi18)
array.push(stocchdidi_arr, stochDidi19)
array.push(stocchdidi_arr, stochDidi20)
array.push(stocchdidi_arr, stochDidi21)
array.push(stocchdidi_arr, stochDidi22)
array.push(stocchdidi_arr, stochDidi23)
array.push(stocchdidi_arr, stochDidi24)
array.push(stocchdidi_arr, stochDidi25)
array.push(stocchdidi_arr, stochDidi26)
array.push(stocchdidi_arr, stochDidi27)
array.push(stocchdidi_arr, stochDidi28)
array.push(stocchdidi_arr, stochDidi29)
array.push(stocchdidi_arr, stochDidi30)
array.push(stocchdidi_arr, stochDidi31)
array.push(stocchdidi_arr, stochDidi32)
array.push(stocchdidi_arr, stochDidi33)
array.push(stocchdidi_arr, stochDidi34)
array.push(stocchdidi_arr, stochDidi35)
array.push(stocchdidi_arr, stochDidi36)
array.push(stocchdidi_arr, stochDidi37)
array.push(stocchdidi_arr, stochDidi38)
array.push(stocchdidi_arr, stochDidi39)
array.push(stocchdidi_arr, stochDidi40)

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

var tbl = table.new(position.bottom_right, 8, 41, frame_color=#151715, frame_width=1, border_width=1, border_color=color.new(color.white, 100))

if barstate.islast

    table.cell(tbl, 0, 0, 'Source', width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    table.cell(tbl, 1, 0, 'Symbol', width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    table.cell(tbl, 2, 0, 'ADX',    width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    table.cell(tbl, 3, 0, 'Didi',   width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    table.cell(tbl, 4, 0, 'BB',     width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    table.cell(tbl, 5, 0, 'Trix',   width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    table.cell(tbl, 6, 0, 'Stoch',  width = col_width,     text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.normal)
    if (scr_numb > 1)
        table.cell(tbl, 7, 0, '', width = col_width * 2 * (scr_numb - 1),     text_halign = text.align_center, bgcolor = color.new(color.gray, 100), text_color = color.white, text_size = size.small)
        

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

            symboldidi_col = array.get(symboldidi_arr, i) == "Bought" ? bgLong1 : array.get(symboldidi_arr, i) == "Sold" ? bgShort1 : array.get(symboldidi_arr, i) == "Close Long" ? bgCloseLong : array.get(symboldidi_arr, i) == "Close Short" ? bgCloseShort : color.gray
            adxd_col = array.get(symboldidi_arr, i) == "Close Long" ? bgCloseLong : array.get(symboldidi_arr, i) == "Close Short" ? bgCloseShort : array.get(symboldidi_arr, i) == "Bought" ? bgLong1 : array.get(adxd_arr, i) == "Uptrend Strong" ? bgLong2 : array.get(adxd_arr, i) == "Uptrend" ? bgLong3 : array.get(adxd_arr, i) == "Uptrend Falling" ? bgLong4 : array.get(symboldidi_arr, i) == "Sold" ? bgShort1 : array.get(adxd_arr, i) == "Downtrend Strong" ? bgShort2 : array.get(adxd_arr, i) == "Downtrend" ? bgShort3 : array.get(adxd_arr, i) == "Downtrend Falling" ? bgShort4 : array.get(adxd_arr, i) == "Kick ADX" ? color.new(#aa2b2b, 0) : color.gray
            didi_col = array.get(symboldidi_arr, i) == "Bought" ? bgLong1 : array.get(symboldidi_arr, i) ==  "BJMA Buy" ? bgLong1 : array.get(symboldidi_arr, i) ==  "BJMA Sell" ? bgLong1 : array.get(didi_arr, i) == "Needle Buy" ? bgLong2 : array.get(didi_arr, i) == "Buy Alert" ? bgLong3 : array.get(didi_arr, i) == "Bought" ? bgLong5 : array.get(didi_arr, i) == "Fake Buy" ? bgLong4 : array.get(symboldidi_arr, i) == "Sold" ? bgShort1 : array.get(didi_arr, i) == "Sold" ? bgShort5 : array.get(didi_arr, i) == "Needle Sell" ? bgShort2 : array.get(didi_arr, i) == "Sell Alert" ? bgShort3 : array.get(didi_arr, i) == "Fake Sell" ? bgShort4 : color.gray
            bb_col   = array.get(symboldidi_arr, i) == "Close Long" ? bgCloseLong : array.get(symboldidi_arr, i) == "Close Short" ? bgCloseShort : array.get(symboldidi_arr, i) == "Bought" ? bgLong1 : array.get(bb_arr, i) == "Open Rising" ? bgLong2 : array.get(bb_arr, i) == "Parallel Rising" ? bgLong3 : array.get(symboldidi_arr, i) == "Sold" ? bgShort1 : array.get(bb_arr, i) == "Open Falling" ? bgShort2 : array.get(bb_arr, i) == "Parallel Falling" ? bgShort3 : array.get(bb_arr, i) == "Close" ? color.new(#aa2b2b, 0) : color.gray
            trix_col = array.get(symboldidi_arr, i) == "Close Long" ? bgCloseLong : array.get(symboldidi_arr, i) == "Close Short" ? bgCloseShort : array.get(trixdidi_arr, i) == "Bought" ? bgLong3 : array.get(trixdidi_arr, i) == "Sold" ? bgShort3 : color.gray
            stoch_col = array.get(symboldidi_arr, i) == "Close Long" ? bgCloseLong : array.get(symboldidi_arr, i) == "Close Short" ? bgCloseShort : array.get(stocchdidi_arr, i) == "Bought" ? bgLong3 : array.get(stocchdidi_arr, i) == "Sold" ? bgShort3 : color.gray

            table.cell(tbl, 0, i + 1, array.get(p_arr, i),          text_halign = text.align_center, bgcolor = color.gray,    text_color = color.white, text_size = size.small)
            table.cell(tbl, 1, i + 1, array.get(s_arr, i),          text_halign = text.align_center, bgcolor = symboldidi_col,  text_color = color.white, text_size = size.small)
            table.cell(tbl, 2, i + 1, array.get(adxd_arr, i),       text_halign = text.align_center, bgcolor = adxd_col,        text_color = color.white, text_size = size.small)
            table.cell(tbl, 3, i + 1, array.get(didi_arr, i),       text_halign = text.align_center, bgcolor = didi_col,        text_color = color.white, text_size = size.small)
            table.cell(tbl, 4, i + 1, array.get(bb_arr, i),         text_halign = text.align_center, bgcolor = bb_col,          text_color = color.white, text_size = size.small)
            table.cell(tbl, 5, i + 1, array.get(trixdidi_arr, i),   text_halign = text.align_center, bgcolor = trix_col,        text_color = color.white, text_size = size.small)
            table.cell(tbl, 6, i + 1, array.get(stocchdidi_arr, i), text_halign = text.align_center, bgcolor = stoch_col,       text_color = color.white, text_size = size.small)

