Advanced Comparison Tool
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © QuantNomad

//@version=5
indicator("Advanced Comparison Tool", shorttitle = "Comp", overlay = true)

t = input.time(timestamp("01 Jan 2022 00:00 +0000"), "Bar", confirm = true)

/////////////
// 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(false, title = "", group = 'Symbols', inline = 's31')
u32 = input.bool(false, title = "", group = 'Symbols', inline = 's32')

s01 = input.symbol('XRPUSDT',  group = 'Symbols', inline = 's01')
s02 = input.symbol('BTCUSDT',  group = 'Symbols', inline = 's02')
s03 = input.symbol('DOGEUSDT', group = 'Symbols', inline = 's03')
s04 = input.symbol('BNBUSDT',  group = 'Symbols', inline = 's04')
s05 = input.symbol('ETHUSDT',  group = 'Symbols', inline = 's05')
s06 = input.symbol('ADAUSDT',  group = 'Symbols', inline = 's06')
s07 = input.symbol('XRPBTC',   group = 'Symbols', inline = 's07')
s08 = input.symbol('DOGEBTC',  group = 'Symbols', inline = 's08')
s09 = input.symbol('TRXUSDT',  group = 'Symbols', inline = 's09')
s10 = input.symbol('BTCBUSD',  group = 'Symbols', inline = 's10')
s11 = input.symbol('ETHBUSD',  group = 'Symbols', inline = 's11')
s12 = input.symbol('BNBBUSD',  group = 'Symbols', inline = 's12')
s13 = input.symbol('VETUSDT',  group = 'Symbols', inline = 's13')
s14 = input.symbol('ETHBTC',   group = 'Symbols', inline = 's14')
s15 = input.symbol('BNBBTC',   group = 'Symbols', inline = 's15')
s16 = input.symbol('EOSUSDT',  group = 'Symbols', inline = 's16')
s17 = input.symbol('XLMUSDT',  group = 'Symbols', inline = 's17')
s18 = input.symbol('LTCUSDT',  group = 'Symbols', inline = 's18')
s19 = input.symbol('XRPBUSD',  group = 'Symbols', inline = 's19')
s20 = input.symbol('WINUSDT',  group = 'Symbols', inline = 's20')
s21 = input.symbol('DOTUSDT',  group = 'Symbols', inline = 's21')
s22 = input.symbol('BTTUSDT',  group = 'Symbols', inline = 's22')
s23 = input.symbol('BCHUSDT',  group = 'Symbols', inline = 's23')
s24 = input.symbol('ADABTC',   group = 'Symbols', inline = 's24')
s25 = input.symbol('IOSTUSDT', group = 'Symbols', inline = 's25')
s26 = input.symbol('CHZUSDT',  group = 'Symbols', inline = 's26')
s27 = input.symbol('LINKUSDT', group = 'Symbols', inline = 's27')
s28 = input.symbol('TRXBTC',   group = 'Symbols', inline = 's28')
s29 = input.symbol('DOGEBUSD', group = 'Symbols', inline = 's29')
s30 = input.symbol('BTCEUR',   group = 'Symbols', inline = 's30')
s31 = input.symbol('FILUSDT',  group = 'Symbols', inline = 's31')
s32 = input.symbol('HOTUSDT',  group = 'Symbols', inline = 's32')

c01 = input.color(#CF3476, title = '', group = 'Symbols', inline = 's01')
c02 = input.color(#57A639, title = '', group = 'Symbols', inline = 's02')
c03 = input.color(#F44611, title = '', group = 'Symbols', inline = 's03')
c04 = input.color(#DE4C8A, title = '', group = 'Symbols', inline = 's04')
c05 = input.color(#6C6960, title = '', group = 'Symbols', inline = 's05')
c06 = input.color(#20214F, title = '', group = 'Symbols', inline = 's06')
c07 = input.color(#C1876B, title = '', group = 'Symbols', inline = 's07')
c08 = input.color(#6D3F5B, title = '', group = 'Symbols', inline = 's08')
c09 = input.color(#4E3B31, title = '', group = 'Symbols', inline = 's09')
c10 = input.color(#B8B799, title = '', group = 'Symbols', inline = 's10')
c11 = input.color(#2D572C, title = '', group = 'Symbols', inline = 's11')
c12 = input.color(#2F4538, title = '', group = 'Symbols', inline = 's12')
c13 = input.color(#686C5E, title = '', group = 'Symbols', inline = 's13')
c14 = input.color(#8F8B66, title = '', group = 'Symbols', inline = 's14')
c15 = input.color(#3E3B32, title = '', group = 'Symbols', inline = 's15')
c16 = input.color(#1E213D, title = '', group = 'Symbols', inline = 's16')
c17 = input.color(#26252D, title = '', group = 'Symbols', inline = 's17')
c18 = input.color(#CF3476, title = '', group = 'Symbols', inline = 's18')
c19 = input.color(#B44C43, title = '', group = 'Symbols', inline = 's19')
c20 = input.color(#35682D, title = '', group = 'Symbols', inline = 's20')
c21 = input.color(#CF3476, title = '', group = 'Symbols', inline = 's21')
c22 = input.color(#57A639, title = '', group = 'Symbols', inline = 's22')
c23 = input.color(#F44611, title = '', group = 'Symbols', inline = 's23')
c24 = input.color(#DE4C8A, title = '', group = 'Symbols', inline = 's24')
c25 = input.color(#6C6960, title = '', group = 'Symbols', inline = 's25')
c26 = input.color(#20214F, title = '', group = 'Symbols', inline = 's26')
c27 = input.color(#C1876B, title = '', group = 'Symbols', inline = 's27')
c28 = input.color(#6D3F5B, title = '', group = 'Symbols', inline = 's28')
c29 = input.color(#4E3B31, title = '', group = 'Symbols', inline = 's29')
c30 = input.color(#B8B799, title = '', group = 'Symbols', inline = 's30')
c31 = input.color(#2D572C, title = '', group = 'Symbols', inline = 's31')
c32 = input.color(#2F4538, title = '', group = 'Symbols', inline = 's32')


///////////////
// FUNCTIONS //

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

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

pnl01 = request.security(s01, timeframe.period, close / close[1] - 1)
pnl02 = request.security(s02, timeframe.period, close / close[1] - 1)
pnl03 = request.security(s03, timeframe.period, close / close[1] - 1)
pnl04 = request.security(s04, timeframe.period, close / close[1] - 1)
pnl05 = request.security(s05, timeframe.period, close / close[1] - 1)
pnl06 = request.security(s06, timeframe.period, close / close[1] - 1)
pnl07 = request.security(s07, timeframe.period, close / close[1] - 1)
pnl08 = request.security(s08, timeframe.period, close / close[1] - 1)
pnl09 = request.security(s09, timeframe.period, close / close[1] - 1)
pnl10 = request.security(s10, timeframe.period, close / close[1] - 1)
pnl11 = request.security(s11, timeframe.period, close / close[1] - 1)
pnl12 = request.security(s12, timeframe.period, close / close[1] - 1)
pnl13 = request.security(s13, timeframe.period, close / close[1] - 1)
pnl14 = request.security(s14, timeframe.period, close / close[1] - 1)
pnl15 = request.security(s15, timeframe.period, close / close[1] - 1)
pnl16 = request.security(s16, timeframe.period, close / close[1] - 1)
pnl17 = request.security(s17, timeframe.period, close / close[1] - 1)
pnl18 = request.security(s18, timeframe.period, close / close[1] - 1)
pnl19 = request.security(s19, timeframe.period, close / close[1] - 1)
pnl20 = request.security(s20, timeframe.period, close / close[1] - 1)
pnl21 = request.security(s21, timeframe.period, close / close[1] - 1)
pnl22 = request.security(s22, timeframe.period, close / close[1] - 1)
pnl23 = request.security(s23, timeframe.period, close / close[1] - 1)
pnl24 = request.security(s24, timeframe.period, close / close[1] - 1)
pnl25 = request.security(s25, timeframe.period, close / close[1] - 1)
pnl26 = request.security(s26, timeframe.period, close / close[1] - 1)
pnl27 = request.security(s27, timeframe.period, close / close[1] - 1)
pnl28 = request.security(s28, timeframe.period, close / close[1] - 1)
pnl29 = request.security(s29, timeframe.period, close / close[1] - 1)
pnl30 = request.security(s30, timeframe.period, close / close[1] - 1)
pnl31 = request.security(s31, timeframe.period, close / close[1] - 1)
pnl32 = request.security(s32, timeframe.period, close / close[1] - 1)

// Define initial vars
float pnl_cum01   = na
float pnl_cum02   = na
float pnl_cum03   = na
float pnl_cum04   = na
float pnl_cum05   = na
float pnl_cum06   = na
float pnl_cum07   = na
float pnl_cum08   = na
float pnl_cum09   = na
float pnl_cum10   = na
float pnl_cum11   = na
float pnl_cum12   = na
float pnl_cum13   = na
float pnl_cum14   = na
float pnl_cum15   = na
float pnl_cum16   = na
float pnl_cum17   = na
float pnl_cum18   = na
float pnl_cum19   = na
float pnl_cum20   = na
float pnl_cum21   = na
float pnl_cum22   = na
float pnl_cum23   = na
float pnl_cum24   = na
float pnl_cum25   = na
float pnl_cum26   = na
float pnl_cum27   = na
float pnl_cum28   = na
float pnl_cum29   = na
float pnl_cum30   = na
float pnl_cum31   = na
float pnl_cum32   = na

float first_close = na    
first_close := time == t ? close : nz(first_close[1])

pnl_cum_cur = close / first_close - 1

pnl_cum01 := time == t ? 0 : time >  t ? (1 + pnl_cum01[1]) * (1 + pnl01) - 1 : pnl_cum01
pnl_cum02 := time == t ? 0 : time >  t ? (1 + pnl_cum02[1]) * (1 + pnl02) - 1 : pnl_cum02
pnl_cum03 := time == t ? 0 : time >  t ? (1 + pnl_cum03[1]) * (1 + pnl03) - 1 : pnl_cum03
pnl_cum04 := time == t ? 0 : time >  t ? (1 + pnl_cum04[1]) * (1 + pnl04) - 1 : pnl_cum04
pnl_cum05 := time == t ? 0 : time >  t ? (1 + pnl_cum05[1]) * (1 + pnl05) - 1 : pnl_cum05
pnl_cum06 := time == t ? 0 : time >  t ? (1 + pnl_cum06[1]) * (1 + pnl06) - 1 : pnl_cum06
pnl_cum07 := time == t ? 0 : time >  t ? (1 + pnl_cum07[1]) * (1 + pnl07) - 1 : pnl_cum07
pnl_cum08 := time == t ? 0 : time >  t ? (1 + pnl_cum08[1]) * (1 + pnl08) - 1 : pnl_cum08
pnl_cum09 := time == t ? 0 : time >  t ? (1 + pnl_cum09[1]) * (1 + pnl09) - 1 : pnl_cum09
pnl_cum10 := time == t ? 0 : time >  t ? (1 + pnl_cum10[1]) * (1 + pnl10) - 1 : pnl_cum10
pnl_cum11 := time == t ? 0 : time >  t ? (1 + pnl_cum11[1]) * (1 + pnl11) - 1 : pnl_cum11
pnl_cum12 := time == t ? 0 : time >  t ? (1 + pnl_cum12[1]) * (1 + pnl12) - 1 : pnl_cum12
pnl_cum13 := time == t ? 0 : time >  t ? (1 + pnl_cum13[1]) * (1 + pnl13) - 1 : pnl_cum13
pnl_cum14 := time == t ? 0 : time >  t ? (1 + pnl_cum14[1]) * (1 + pnl14) - 1 : pnl_cum14
pnl_cum15 := time == t ? 0 : time >  t ? (1 + pnl_cum15[1]) * (1 + pnl15) - 1 : pnl_cum15
pnl_cum16 := time == t ? 0 : time >  t ? (1 + pnl_cum16[1]) * (1 + pnl16) - 1 : pnl_cum16
pnl_cum17 := time == t ? 0 : time >  t ? (1 + pnl_cum17[1]) * (1 + pnl17) - 1 : pnl_cum17
pnl_cum18 := time == t ? 0 : time >  t ? (1 + pnl_cum18[1]) * (1 + pnl18) - 1 : pnl_cum18
pnl_cum19 := time == t ? 0 : time >  t ? (1 + pnl_cum19[1]) * (1 + pnl19) - 1 : pnl_cum19
pnl_cum20 := time == t ? 0 : time >  t ? (1 + pnl_cum20[1]) * (1 + pnl20) - 1 : pnl_cum20
pnl_cum21 := time == t ? 0 : time >  t ? (1 + pnl_cum21[1]) * (1 + pnl21) - 1 : pnl_cum21
pnl_cum22 := time == t ? 0 : time >  t ? (1 + pnl_cum22[1]) * (1 + pnl22) - 1 : pnl_cum22
pnl_cum23 := time == t ? 0 : time >  t ? (1 + pnl_cum23[1]) * (1 + pnl23) - 1 : pnl_cum23
pnl_cum24 := time == t ? 0 : time >  t ? (1 + pnl_cum24[1]) * (1 + pnl24) - 1 : pnl_cum24
pnl_cum25 := time == t ? 0 : time >  t ? (1 + pnl_cum25[1]) * (1 + pnl25) - 1 : pnl_cum25
pnl_cum26 := time == t ? 0 : time >  t ? (1 + pnl_cum26[1]) * (1 + pnl26) - 1 : pnl_cum26
pnl_cum27 := time == t ? 0 : time >  t ? (1 + pnl_cum27[1]) * (1 + pnl27) - 1 : pnl_cum27
pnl_cum28 := time == t ? 0 : time >  t ? (1 + pnl_cum28[1]) * (1 + pnl28) - 1 : pnl_cum28
pnl_cum29 := time == t ? 0 : time >  t ? (1 + pnl_cum29[1]) * (1 + pnl29) - 1 : pnl_cum29
pnl_cum30 := time == t ? 0 : time >  t ? (1 + pnl_cum30[1]) * (1 + pnl30) - 1 : pnl_cum30
pnl_cum31 := time == t ? 0 : time >  t ? (1 + pnl_cum31[1]) * (1 + pnl31) - 1 : pnl_cum31
pnl_cum32 := time == t ? 0 : time >  t ? (1 + pnl_cum32[1]) * (1 + pnl32) - 1 : pnl_cum32

plot(first_close * (pnl_cum01 + 1), title = 'S01', color = u01 ? c01 : color.new(color.white, 100))
plot(first_close * (pnl_cum02 + 1), title = 'S02', color = u02 ? c02 : color.new(color.white, 100))
plot(first_close * (pnl_cum03 + 1), title = 'S03', color = u03 ? c03 : color.new(color.white, 100))
plot(first_close * (pnl_cum04 + 1), title = 'S04', color = u04 ? c04 : color.new(color.white, 100))
plot(first_close * (pnl_cum05 + 1), title = 'S05', color = u05 ? c05 : color.new(color.white, 100))
plot(first_close * (pnl_cum06 + 1), title = 'S06', color = u06 ? c06 : color.new(color.white, 100))
plot(first_close * (pnl_cum07 + 1), title = 'S07', color = u07 ? c07 : color.new(color.white, 100))
plot(first_close * (pnl_cum08 + 1), title = 'S08', color = u08 ? c08 : color.new(color.white, 100))
plot(first_close * (pnl_cum09 + 1), title = 'S09', color = u09 ? c09 : color.new(color.white, 100))
plot(first_close * (pnl_cum10 + 1), title = 'S10', color = u10 ? c10 : color.new(color.white, 100))
plot(first_close * (pnl_cum11 + 1), title = 'S11', color = u11 ? c11 : color.new(color.white, 100))
plot(first_close * (pnl_cum12 + 1), title = 'S12', color = u12 ? c12 : color.new(color.white, 100))
plot(first_close * (pnl_cum13 + 1), title = 'S13', color = u13 ? c13 : color.new(color.white, 100))
plot(first_close * (pnl_cum14 + 1), title = 'S14', color = u14 ? c14 : color.new(color.white, 100))
plot(first_close * (pnl_cum15 + 1), title = 'S15', color = u15 ? c15 : color.new(color.white, 100))
plot(first_close * (pnl_cum16 + 1), title = 'S16', color = u16 ? c16 : color.new(color.white, 100))
plot(first_close * (pnl_cum17 + 1), title = 'S17', color = u17 ? c17 : color.new(color.white, 100))
plot(first_close * (pnl_cum18 + 1), title = 'S18', color = u18 ? c18 : color.new(color.white, 100))
plot(first_close * (pnl_cum19 + 1), title = 'S19', color = u19 ? c19 : color.new(color.white, 100))
plot(first_close * (pnl_cum20 + 1), title = 'S20', color = u20 ? c20 : color.new(color.white, 100))
plot(first_close * (pnl_cum21 + 1), title = 'S21', color = u21 ? c21 : color.new(color.white, 100))
plot(first_close * (pnl_cum22 + 1), title = 'S22', color = u22 ? c22 : color.new(color.white, 100))
plot(first_close * (pnl_cum23 + 1), title = 'S23', color = u23 ? c23 : color.new(color.white, 100))
plot(first_close * (pnl_cum24 + 1), title = 'S24', color = u24 ? c24 : color.new(color.white, 100))
plot(first_close * (pnl_cum25 + 1), title = 'S25', color = u25 ? c25 : color.new(color.white, 100))
plot(first_close * (pnl_cum26 + 1), title = 'S26', color = u26 ? c26 : color.new(color.white, 100))
plot(first_close * (pnl_cum27 + 1), title = 'S27', color = u27 ? c27 : color.new(color.white, 100))
plot(first_close * (pnl_cum28 + 1), title = 'S28', color = u28 ? c28 : color.new(color.white, 100))
plot(first_close * (pnl_cum29 + 1), title = 'S29', color = u29 ? c29 : color.new(color.white, 100))
plot(first_close * (pnl_cum30 + 1), title = 'S30', color = u30 ? c30 : color.new(color.white, 100))
plot(first_close * (pnl_cum31 + 1), title = 'S31', color = u31 ? c31 : color.new(color.white, 100))
plot(first_close * (pnl_cum32 + 1), title = 'S32', color = u32 ? c32 : color.new(color.white, 100))

////////////////
// PLOT TABLE //

var tbl = table.new(position.bottom_left, 3, 42, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(color.white, 100))

if barstate.islast
    table.cell(tbl, 0, 0, 'Symbol', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto)
    table.cell(tbl, 1, 0, 'P&L',    text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto)
    table.cell(tbl, 2, 0, 'Color',  text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto)
    
    table.cell(tbl, 0, 1, "Current",                                     text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
    table.cell(tbl, 1, 1, str.tostring(pnl_cum_cur * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = color.gray, text_color = color.white, text_size = size.auto)
    table.cell(tbl, 2, 1, '', text_halign = text.align_center,                                            bgcolor = color.gray, text_color = color.white, text_size = size.auto)
    
    if (u01)
        table.cell(tbl, 0, 2, only_symbol(s01),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 2, str.tostring(pnl_cum01 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 2, '', text_halign = text.align_center,                                          bgcolor = c01,        text_color = color.white, text_size = size.auto)
        
    if (u02)
        table.cell(tbl, 0, 3, only_symbol(s02),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 3, str.tostring(pnl_cum02 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 3, '', text_halign = text.align_center,                                          bgcolor = c02,        text_color = color.white, text_size = size.auto)
        
    if (u03)
        table.cell(tbl, 0, 4, only_symbol(s03),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 4, str.tostring(pnl_cum03 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 4, '', text_halign = text.align_center,                                          bgcolor = c03,        text_color = color.white, text_size = size.auto)
        
    if (u04)
        table.cell(tbl, 0, 5, only_symbol(s04),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 5, str.tostring(pnl_cum04 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 5, '', text_halign = text.align_center,                                          bgcolor = c04,        text_color = color.white, text_size = size.auto)
        
    if (u05)
        table.cell(tbl, 0, 6, only_symbol(s05),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 6, str.tostring(pnl_cum05 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 6, '', text_halign = text.align_center,                                          bgcolor = c05,        text_color = color.white, text_size = size.auto)
        
    if (u06)
        table.cell(tbl, 0, 7, only_symbol(s06),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 7, str.tostring(pnl_cum06 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 7, '', text_halign = text.align_center,                                          bgcolor = c06,        text_color = color.white, text_size = size.auto)
        
    if (u07)
        table.cell(tbl, 0, 8, only_symbol(s07),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 8, str.tostring(pnl_cum07 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 8, '', text_halign = text.align_center,                                          bgcolor = c07,        text_color = color.white, text_size = size.auto)
        
    if (u08)
        table.cell(tbl, 0, 9, only_symbol(s08),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 9, str.tostring(pnl_cum08 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 9, '', text_halign = text.align_center,                                          bgcolor = c08,        text_color = color.white, text_size = size.auto)
        
    if (u09)
        table.cell(tbl, 0, 10, only_symbol(s09),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 10, str.tostring(pnl_cum09 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 10, '', text_halign = text.align_center,                                          bgcolor = c09,        text_color = color.white, text_size = size.auto)
        
    if (u10)
        table.cell(tbl, 0, 11, only_symbol(s10),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 11, str.tostring(pnl_cum10 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 11, '', text_halign = text.align_center,                                          bgcolor = c10,        text_color = color.white, text_size = size.auto)
        
    if (u11)
        table.cell(tbl, 0, 12, only_symbol(s11),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 12, str.tostring(pnl_cum11 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 12, '', text_halign = text.align_center,                                          bgcolor = c11,        text_color = color.white, text_size = size.auto)
        
    if (u12)
        table.cell(tbl, 0, 13, only_symbol(s12),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 13, str.tostring(pnl_cum12 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 13, '', text_halign = text.align_center,                                          bgcolor = c12,        text_color = color.white, text_size = size.auto)
        
    if (u13)
        table.cell(tbl, 0, 14, only_symbol(s13),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 14, str.tostring(pnl_cum13 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 14, '', text_halign = text.align_center,                                          bgcolor = c13,        text_color = color.white, text_size = size.auto)
        
    if (u14)
        table.cell(tbl, 0, 15, only_symbol(s14),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 15, str.tostring(pnl_cum14 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 15, '', text_halign = text.align_center,                                          bgcolor = c14,        text_color = color.white, text_size = size.auto)
        
    if (u15)
        table.cell(tbl, 0, 16, only_symbol(s15),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 16, str.tostring(pnl_cum15 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 16, '', text_halign = text.align_center,                                          bgcolor = c15,        text_color = color.white, text_size = size.auto)
        
    if (u16)
        table.cell(tbl, 0, 17, only_symbol(s16),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 17, str.tostring(pnl_cum16 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 17, '', text_halign = text.align_center,                                          bgcolor = c16,        text_color = color.white, text_size = size.auto)
        
    if (u17)
        table.cell(tbl, 0, 18, only_symbol(s17),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 18, str.tostring(pnl_cum17 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 18, '', text_halign = text.align_center,                                          bgcolor = c17,        text_color = color.white, text_size = size.auto)
        
    if (u18)
        table.cell(tbl, 0, 19, only_symbol(s18),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 19, str.tostring(pnl_cum18 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 19, '', text_halign = text.align_center,                                          bgcolor = c18,        text_color = color.white, text_size = size.auto)
        
    if (u19)
        table.cell(tbl, 0, 20, only_symbol(s19),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 20, str.tostring(pnl_cum19 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 20, '', text_halign = text.align_center,                                          bgcolor = c19,        text_color = color.white, text_size = size.auto)
        
    if (u20)
        table.cell(tbl, 0, 21, only_symbol(s20),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 21, str.tostring(pnl_cum20 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 21, '', text_halign = text.align_center,                                          bgcolor = c20,        text_color = color.white, text_size = size.auto)
        
    if (u21)
        table.cell(tbl, 0, 22, only_symbol(s21),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 22, str.tostring(pnl_cum21 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 22, '', text_halign = text.align_center,                                          bgcolor = c21,        text_color = color.white, text_size = size.auto)
        
    if (u22)
        table.cell(tbl, 0, 23, only_symbol(s22),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 23, str.tostring(pnl_cum22 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 23, '', text_halign = text.align_center,                                          bgcolor = c22,        text_color = color.white, text_size = size.auto)
        
    if (u23)
        table.cell(tbl, 0, 24, only_symbol(s23),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 24, str.tostring(pnl_cum23 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 24, '', text_halign = text.align_center,                                          bgcolor = c23,        text_color = color.white, text_size = size.auto)
        
    if (u24)
        table.cell(tbl, 0, 25, only_symbol(s24),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 25, str.tostring(pnl_cum24 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 25, '', text_halign = text.align_center,                                          bgcolor = c24,        text_color = color.white, text_size = size.auto)
        
    if (u25)
        table.cell(tbl, 0, 26, only_symbol(s25),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 26, str.tostring(pnl_cum25 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 26, '', text_halign = text.align_center,                                          bgcolor = c25,        text_color = color.white, text_size = size.auto)
        
    if (u26)
        table.cell(tbl, 0, 27, only_symbol(s26),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 27, str.tostring(pnl_cum26 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 27, '', text_halign = text.align_center,                                          bgcolor = c26,        text_color = color.white, text_size = size.auto)
        
    if (u27)
        table.cell(tbl, 0, 28, only_symbol(s27),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 28, str.tostring(pnl_cum27 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 28, '', text_halign = text.align_center,                                          bgcolor = c27,        text_color = color.white, text_size = size.auto)
        
    if (u28)
        table.cell(tbl, 0, 29, only_symbol(s28),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 29, str.tostring(pnl_cum28 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 29, '', text_halign = text.align_center,                                          bgcolor = c28,        text_color = color.white, text_size = size.auto)
        
    if (u29)
        table.cell(tbl, 0, 30, only_symbol(s29),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 30, str.tostring(pnl_cum29 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 30, '', text_halign = text.align_center,                                          bgcolor = c29,        text_color = color.white, text_size = size.auto)
        
    if (u30)
        table.cell(tbl, 0, 31, only_symbol(s30),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 31, str.tostring(pnl_cum30 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 31, '', text_halign = text.align_center,                                          bgcolor = c30,        text_color = color.white, text_size = size.auto)
        
    if (u31)
        table.cell(tbl, 0, 32, only_symbol(s31),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 32, str.tostring(pnl_cum31 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 32, '', text_halign = text.align_center,                                          bgcolor = c31,        text_color = color.white, text_size = size.auto)
        
    if (u32)
        table.cell(tbl, 0, 33, only_symbol(s32),                            text_halign = text.align_left,   bgcolor = color.gray, text_color = color.white, text_size = size.auto)
        table.cell(tbl, 1, 33, str.tostring(pnl_cum32 * 100,  '.##') + '%', text_halign = text.align_center, bgcolor = #aaaaaa,    text_color = color.white, text_size = size.auto)
        table.cell(tbl, 2, 33, '', text_halign = text.align_center,                                          bgcolor = c32,        text_color = color.white, text_size = size.auto)
