ETF Holdings and Sectors [SS]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//  /$$$$$$   /$$                                                         /$$                                            
// /$$__  $$ | $$                                                        | $$                                            
//| $$  \__//$$$$$$    /$$$$$$  /$$    /$$ /$$$$$$   /$$$$$$   /$$$$$$$ /$$$$$$    /$$$$$$  /$$    /$$ /$$$$$$   /$$$$$$$
//|  $$$$$$|_  $$_/   /$$__  $$|  $$  /$$//$$__  $$ /$$__  $$ /$$_____/|_  $$_/   /$$__  $$|  $$  /$$//$$__  $$ /$$_____/
// \____  $$ | $$    | $$$$$$$$ \  $$/$$/| $$$$$$$$| $$  \__/|  $$$$$$   | $$    | $$$$$$$$ \  $$/$$/| $$$$$$$$|  $$$$$$ 
// /$$  \ $$ | $$ /$$| $$_____/  \  $$$/ | $$_____/| $$       \____  $$  | $$ /$$| $$_____/  \  $$$/ | $$_____/ \____  $$
//|  $$$$$$/ |  $$$$/|  $$$$$$$   \  $/  |  $$$$$$$| $$       /$$$$$$$/  |  $$$$/|  $$$$$$$   \  $/  |  $$$$$$$ /$$$$$$$/
// \______/   \___/   \_______/    \_/    \_______/|__/      |_______/    \___/   \_______/    \_/    \_______/|_______/ 

//       ___________________
//      /                   \
//     /  _____        _____ \
//    /  /     \      /     \  \
// __/__/       \____/       \__\_____
//|           ___________           ____|
// \_________/           \_________/
//            \  /////// /
//             \/////////
// © Steversteves
//@version=5
indicator("ETF Holdings and Sectors [SS]", overlay=true)
import Steversteves/ETFHoldingsLib/5 as etf 
import Steversteves/ETFFinderLib/3 as etfsearch 
// Groups 
g1 = "Auto vs Manual Select"
g2 = "Performance Timeframe" 
g3 = "Plot Options" 
g4 = "Search ETFs for Current Ticker"
g5 = "Search by Sector" 
g6 = "Search by Interest"

// User Inputs 
manual_select = input.string("Auto", "Select ETF Manually or Auto", ["Auto", "SPY", "QQQ", "IWM", "ARKK", "VEA", "BRK.B", "ITA", "BLCR", "VGT", "VIG", "VNQ", "VTV", "XBI", "VUG", "VWO", "XLE", "XLF", "XLV", "DIA", "FNGG", "FNGU", "BNGE", "IXP", "FCOM", "PNQI", "CHPS", "SOXX", "XLK", "MOON", "UFO", "VDC", "IEDI", "VIRS", "FTXG", "JETS", "IYJ", "FXR", "IYC", "XLY", "IYK", "FDIS", "PEJ", "IYT", "FTXR", "XTN", "SEA"], group = g1)
perf_over =     input.int(252, "Performance Over # Days", group = g2)
show_top10 =    input.bool(true, "Show Top 10 Holdings", group = g3) 
show_sectors =  input.bool(true, "Show Sectors", group = g3) 
search_etfs =   input.bool(true, "Search ETFs for Current Ticker", group = g4)
search_sector = input.string("None", "Search by Sector", ["None", "Basic Materials", "Consumer Cyclical", "Financial Services", "Real Estate", "Consumer Defensive", "Healthcare", "Utilities", "Communication Services", "Energy", "Industrials", "Technology"], group = g5)
search_int =    input.string("None", "Search area of Interest", ["None", "Aviation", "Food and Foodstuffs", "Transportation", "Maratime", "Gaming", "Computing", "Telecommunications", "Commerce and Stores", "Industrials and Heavy Machinary", "Entertainment", "Finance and Banking", "Real Estate"], group = g6)
// Current Ticker for Auto Select
current = syminfo.ticker
// Colours 
color black = color.rgb(0, 0, 0) 
color white =color.white 

var table data = table.new(position.top_right, 6, 14, bgcolor = black, frame_color = white, frame_width = 3) 
annual_performance = request.security(syminfo.tickerid, "D", (close - close[perf_over]) / close[perf_over] * 100) 
// Pull ETF Data
[qqq_info1, qqq_info2, qqq_info3, qqq_info4] = etf.qqq_get()
// Search by sector 
if search_sector != "None"
    [sector_etf_result, sector_etf_holding] = etfsearch.etf_search_sectors(str.tostring(search_sector))

    var table sector_table = table.new(position.middle_center, 3, 40, bgcolor = color.blue, frame_color = white, frame_width = 2, border_color = color.gray, border_width = 1)
    table.cell(sector_table, 1, 1, text = str.tostring(search_sector), bgcolor = color.blue, text_color = color.white)
    table.merge_cells(sector_table, 1, 1, 2, 1) 
    table.cell(sector_table, 1, 2, text = "ETF", bgcolor = color.blue, text_color = color.white)
    table.cell(sector_table, 2, 2, text = "% Holding", bgcolor = color.blue, text_color = color.white)
    
    for i = 0 to array.size(sector_etf_result) - 1 
        table.cell(sector_table, 1, 3 + i, text = str.tostring(array.get(sector_etf_result, i)), bgcolor = color.blue, text_color = white) 
        table.cell(sector_table, 2, 3 + i, text = str.tostring(array.get(sector_etf_holding, i)), bgcolor = color.blue, text_color = white)

// Search by Ticker 
if search_etfs 
    [info, comp] = etfsearch.etf_search_ticker(syminfo.ticker)
    var table results = table.new(position.bottom_right, 3, 40, bgcolor = color.gray, frame_color = white, frame_width = 3, border_color = color.blue, border_width = 1)
    if array.size(info) > 0 
        table.cell(results, 1, 1, text = "ETF", bgcolor = color.gray, text_color = white)
        table.cell(results, 2, 1, text = "% ETF \n Holding", bgcolor = color.gray, text_color = white)
        for i = 0 to array.size(info) - 1
            table.cell(results, 1, 2 + i, text = str.tostring(array.get(info, i)), bgcolor = color.gray, text_color = color.white) 
        for i = 0 to array.size(comp) - 1 
            table.cell(results, 2, 2 + i, text = str.tostring(array.get(comp, i)) + "%", bgcolor = color.gray, text_color = color.white) 

// Search by Intereste 
f_search_interest(interest_input) => 
    output = array.new<string>() 
    if interest_input == "Aviation" 
        array.push(output, "ITA")
        array.push(output, "JETS")
        array.push(output, "IYT") 
        array.push(output, "IYJ")
    if interest_input == "Food and Foodstuffs"
        array.push(output, "VDC")
        array.push(output, "IEDI")
        array.push(output, "PEJ")
    if interest_input == "Transportation" 
        array.push(output, "SEA") 
        array.push(output, "IYT")
        array.push(output, "FTXR")
        array.push(output, "XTN")
    if interest_input == "Maratime"
        array.push(output, "SEA")
        array.push(output, "PEJ")
    if interest_input == "Gaming" 
        array.push(output, "BNGE")
        array.push(output, "CHPS")
        array.push(output, "SOXX")
    if interest_input == "Computing"
        array.push(output, "SOXX")
        array.push(output, "CHPS")
        array.push(output, "FNGG")
        array.push(output, "FNGU")
        array.push(output, "BLCR")
        array.push(output, "PNQI")
    if interest_input == "Telecommunications" 
        array.push(output, "FCOM") 
        array.push(output, "CHPS")
        array.push(output, "IXP")
        array.push(output, "UFO")
    if interest_input == "Commerce and Stores" 
        array.push(output, "VDC") 
        array.push(output, "IEDI")
        array.push(output, "VIRS")
        array.push(output, "IYC")
    if interest_input == "Industrials and Heavy Machinary"
        array.push(output, "IYJ") 
        array.push(output, "ITA")
        array.push(output, "SEA")
        array.push(output, "DIA")
    if interest_input == "Entertainment" 
        array.push(output, "PEJ") 
        array.push(output, "JETS")
    if interest_input == "Finance and Banking" 
        array.push(output, "XLF")
        array.push(output, "VIG")
        array.push(output, "VTV")
        array.push(output, "BRK.B")
    if interest_input == "Real Estate" 
        array.push(output, "VNQ")
    output 
      
if search_int != "None" and search_sector == "None" 
    output_array = f_search_interest(str.tostring(search_int))
    var table sector_table = table.new(position.middle_center, 3, 40, bgcolor = color.blue, frame_color = white, frame_width = 2, border_color = color.gray, border_width = 1)
    table.cell(sector_table, 1, 1, text = str.tostring(search_int), bgcolor = color.blue, text_color = color.white)
    for i = 0 to array.size(output_array) - 1 
        table.cell(sector_table, 1, i + 2, text = str.tostring(array.get(output_array, i)), bgcolor = color.blue, text_color = color.white) 


// PLOT ETF Data 
if current == "SPY" or current == "UPRO" or current == "SPXL" or current == "SPXS" or current == "SPXU" or manual_select == "SPY"
    [spy_info1, spy_info2, spy_info3, spy_info4] = etf.spy_get() 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(spy_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(spy_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(spy_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(spy_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(spy_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(spy_info4, i)), bgcolor = black, text_color = color.white) 
 

if current == "QQQ" or current == "TQQQ" or current == "SQQQ" or manual_select == "QQQ" 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white)
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(qqq_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(qqq_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(qqq_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(qqq_info4, i)), bgcolor = black, text_color = color.white) 
 
if current == "IWM" or current == "TNA" or current == "TZA" or manual_select == "IWM"
    [iwm_info1, iwm_info2, iwm_info3, iwm_info4] = etf.iwm_get() 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red)
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(iwm_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(iwm_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(iwm_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(iwm_info4, i)), bgcolor = black, text_color = color.white) 

if current == "ARKK"or current == "SARK" or manual_select == "ARKK"
    [arkk_info1, arkk_info2, arkk_info3, arkk_info4] = etf.arkk_get() 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(arkk_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(arkk_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(arkk_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(arkk_info4, i)), bgcolor = black, text_color = color.white) 

if current == "VEA" or manual_select == "VEA"
    [vea_info1, vea_info2, vea_info3, vea_info4] = etf.vea_get() 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vea_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vea_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vea_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vea_info4, i)), bgcolor = black, text_color = color.white) 

if current == "BRK.B" or manual_select == "BRK.B"
    [brk_info1, brk_info2, brk_info3, brk_info4] = etf.brk_get() 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(brk_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(brk_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(brk_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(brk_info4, i)), bgcolor = black, text_color = color.white) 

if current == "ITA" or manual_select == "ITA" or current == "DFEN" 
    [ita_info1, ita_info2, ita_info3, ita_info4] = etf.ita_get() 
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(ita_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(ita_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(ita_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(ita_info4, i)), bgcolor = black, text_color = color.white) 

if current == "BLCR" or manual_select == "BLCR"
    [blcr_info1, blcr_info2, blcr_info3, blcr_info4] = etf.blcr_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(blcr_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(blcr_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(blcr_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(blcr_info4, i)), bgcolor = black, text_color = color.white) 

if current == "VGT" or manual_select == "VGT"
    [vgt_info1, vgt_info2, vgt_info3, vgt_info4] = etf.vgt_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vgt_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vgt_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vgt_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vgt_info4, i)), bgcolor = black, text_color = color.white) 

if current == "VIG" or manual_select == "VIG"
    [vig_info1, vig_info2, vig_info3, vig_info4] =etf.vig_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vig_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vig_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vig_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vig_info4, i)), bgcolor = black, text_color = color.white) 

if current == "VNQ" or manual_select == "VNQ"
    [vnq_info1, vnq_info2, vnq_info3, vnq_info4] = etf.vnq_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vnq_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vnq_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vnq_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vnq_info4, i)), bgcolor = black, text_color = color.white) 

if current == "VTV" or manual_select == "VTV"
    [vtv_info1, vtv_info2, vtv_info3, vtv_info4] = etf.vtv_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vtv_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vtv_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vtv_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vtv_info4, i)), bgcolor = black, text_color = color.white) 

if current == "XBI" or current == "LABU" or current == "LABD" or manual_select == "XBI"
    [xbi_info1, xbi_info2, xbi_info3, xbi_info4] = etf.xbi_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xbi_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xbi_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xbi_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xbi_info4, i)), bgcolor = black, text_color = color.white) 
if current == "VUG" or manual_select == "VUG"
    [vug_info1, vug_info2, vug_info3, vug_info4] = etf.vug_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vug_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vug_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vug_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vug_info4, i)), bgcolor = black, text_color = color.white) 

if current == "VWO" or manual_select == "VWO"
    [vwo_info1, vwo_info2, vwo_info3, vwo_info4] = etf.vwo_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vwo_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vwo_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vwo_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vwo_info4, i)), bgcolor = black, text_color = color.white) 

if current == "XLE" or manual_select == "XLE"
    [xle_info1, xle_info2, xle_info3, xle_info4] = etf.xle_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xle_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xle_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xle_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xle_info4, i)), bgcolor = black, text_color = color.white) 

if current == "XLF" or manual_select == "XLF"
    [xlf_info1, xlf_info2, xlf_info3, xlf_info4] = etf.xlf_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xlf_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xlf_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xlf_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xlf_info4, i)), bgcolor = black, text_color = color.white) 

if current == "XLV" or manual_select == "XLV"
    [xlv_info1, xlv_info2, xlv_info3, xlv_info4] = etf.xlv_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xlv_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xlv_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xlv_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xlv_info4, i)), bgcolor = black, text_color = color.white) 

if current == "DIA" or manual_select == "DIA"
    [dia_info1, dia_info2, dia_info3, dia_info4] = etf.dia_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(dia_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(dia_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(dia_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(dia_info4, i)), bgcolor = black, text_color = color.white) 

if current == "FNGG" or manual_select == "FNGG"
    [fngg_info1, fngg_info2, fngg_info3, fngg_info4] = etf.fngg_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(fngg_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(fngg_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(fngg_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(fngg_info4, i)), bgcolor = black, text_color = color.white) 

if current == "FNGU" or manual_select == "FNGU"
    [fngu_info1, fngu_info2, fngu_info3, fngu_info4] = etf.fngu_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(fngu_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(fngu_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(fngu_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(fngu_info4, i)), bgcolor = black, text_color = color.white) 
if current == "BNGE" or manual_select == "BNGE"
    [bnge_info1, bnge_info2, bnge_info3, bnge_info4] = etf.bnge_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(bnge_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(bnge_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(bnge_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(bnge_info4, i)), bgcolor = black, text_color = color.white)
if current == "IXP" or manual_select == "IXP"
    [ixp_info1, ixp_info2, ixp_info3, ixp_info4] = etf.ixp_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(ixp_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(ixp_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(ixp_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(ixp_info4, i)), bgcolor = black, text_color = color.white)
if current == "FCOM" or manual_select == "FCOM"
    [fcom_info1, fcom_info2, fcom_info3, fcom_info4] = etf.fcom_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(fcom_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(fcom_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(fcom_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(fcom_info4, i)), bgcolor = black, text_color = color.white)

if current == "PNQI" or manual_select == "PNQI"
    [pnqi_info1, pnqi_info2, pnqi_info3, pnqi_info4] = etf.pnqi_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(pnqi_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(pnqi_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(pnqi_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(pnqi_info4, i)), bgcolor = black, text_color = color.white)
if current == "CHPS" or manual_select == "CHPS"
    [chps_info1, chps_info2, chps_info3, chps_info4] = etf.chps_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(chps_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(chps_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(chps_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(chps_info4, i)), bgcolor = black, text_color = color.white)
if current == "SOXX" or manual_select == "SOXX"
    [soxx_info1, soxx_info2, soxx_info3, soxx_info4] = etf.soxx_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(soxx_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(soxx_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(soxx_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(soxx_info4, i)), bgcolor = black, text_color = color.white)
if current == "XLK" or manual_select == "XLK"
    [xlk_info1, xlk_info2, xlk_info3, xlk_info4] = etf.xlk_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xlk_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xlk_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xlk_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xlk_info4, i)), bgcolor = black, text_color = color.white)
if current == "MOON" or manual_select == "MOON"
    [moon_info1, moon_info2, moon_info3, moon_info4] = etf.moon_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(moon_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(moon_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(moon_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(moon_info4, i)), bgcolor = black, text_color = color.white)
if current == "UFO" or manual_select == "UFO"
    [ufo_info1, ufo_info2, ufo_info3, ufo_info4] = etf.ufo_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(ufo_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(ufo_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(ufo_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(ufo_info4, i)), bgcolor = black, text_color = color.white)

if current == "VDC" or manual_select == "VDC"
    [vdc_info1, vdc_info2, vdc_info3, vdc_info4] = etf.vdc_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(vdc_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(vdc_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(vdc_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(vdc_info4, i)), bgcolor = black, text_color = color.white)

if current == "IEDI" or manual_select == "IEDI"
    [iedi_info1, iedi_info2, iedi_info3, iedi_info4] = etf.iedi_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(iedi_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(iedi_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(iedi_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(iedi_info4, i)), bgcolor = black, text_color = color.white)


if current == "VIRS" or manual_select == "VIRS"
    [virs_info1, virs_info2, virs_info3, virs_info4] = etf.virs_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(virs_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(virs_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(virs_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(virs_info4, i)), bgcolor = black, text_color = color.white)


if current == "FTXG" or manual_select == "FTXG"
    [ftxg_info1, ftxg_info2, ftxg_info3, ftxg_info4] = etf.ftxg_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(ftxg_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(ftxg_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(ftxg_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(ftxg_info4, i)), bgcolor = black, text_color = color.white)

if current == "JETS" or manual_select == "JETS"
    [jets_info1, jets_info2, jets_info3, jets_info4] = etf.jets_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(jets_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(jets_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(jets_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(jets_info4, i)), bgcolor = black, text_color = color.white)

if current == "IYJ" or manual_select == "IYJ"
    [iyj_info1, iyj_info2, iyj_info3, iyj_info4] = etf.iyj_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(iyj_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(iyj_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(iyj_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(iyj_info4, i)), bgcolor = black, text_color = color.white)
if current == "FXR" or manual_select == "FXR"
    [fxr_info1, fxr_info2, fxr_info3, fxr_info4] = etf.fxr_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(fxr_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(fxr_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(fxr_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(fxr_info4, i)), bgcolor = black, text_color = color.white)

if current == "IYC" or manual_select == "IYC"
    [iyc_info1, iyc_info2, iyc_info3, iyc_info4] = etf.iyc_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(iyc_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(iyc_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(iyc_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(iyc_info4, i)), bgcolor = black, text_color = color.white)
if current == "XLY" or manual_select == "XLY"
    [xly_info1, xly_info2, xly_info3, xly_info4] = etf.xly_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xly_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xly_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xly_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xly_info4, i)), bgcolor = black, text_color = color.white)

if current == "IYK" or manual_select == "IYK"
    [iyk_info1, iyk_info2, iyk_info3, iyk_info4] = etf.iyk_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(iyk_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(iyk_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(iyk_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(iyk_info4, i)), bgcolor = black, text_color = color.white)

if current == "FDIS" or manual_select == "FDIS"
    [fdis_info1, fdis_info2, fdis_info3, fdis_info4] = etf.fdis_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(fdis_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(fdis_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(fdis_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(fdis_info4, i)), bgcolor = black, text_color = color.white)

if current == "PEJ" or manual_select == "PEJ"
    [pej_info1, pej_info2, pej_info3, pej_info4] = etf.pej_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(pej_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(pej_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(pej_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(pej_info4, i)), bgcolor = black, text_color = color.white)


if current == "IYT" or manual_select == "IYT"
    [iyt_info1, iyt_info2, iyt_info3, iyt_info4] = etf.iyt_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(iyt_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(iyt_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(iyt_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(iyt_info4, i)), bgcolor = black, text_color = color.white)

if current == "FTXR" or manual_select == "FTXR"
    [ftxr_info1, ftxr_info2, ftxr_info3, ftxr_info4] = etf.ftxr_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(ftxr_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(ftxr_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(ftxr_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(ftxr_info4, i)), bgcolor = black, text_color = color.white)


if current == "XTN" or manual_select == "XTN"
    [xtn_info1, xtn_info2, xtn_info3, xtn_info4] = etf.xtn_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(xtn_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(xtn_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(xtn_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(xtn_info4, i)), bgcolor = black, text_color = color.white)


if current == "SEA" or manual_select == "SEA"
    [sea_info1, sea_info2, sea_info3, sea_info4] = etf.sea_get()
    table.cell(data, 1, 12, text = "Performance over \n" + str.tostring(perf_over) + " Days", bgcolor = black, text_color = color.white) 
    table.cell(data, 2, 12, text = str.tostring(math.round(annual_performance,2)) + "%", bgcolor = black, text_color = annual_performance > 0 ? color.lime : color.red) 
    if show_top10 
        table.cell(data, 1, 1, text = "Top 10 \n Holdings", bgcolor = black, text_color = color.white) 
        table.cell(data, 2, 1, text = "Top 10 \n Holdings %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info1) - 1
            table.cell(data, 1, 2 + i, text = str.tostring(array.get(sea_info1, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 2, 2 + i, text = str.tostring(array.get(sea_info2, i)), bgcolor = black, text_color = color.white) 
    if show_sectors 
        table.cell(data, 3, 1, text = "Sector \n Breakdown", bgcolor = black, text_color = color.white) 
        table.cell(data, 4, 1, text = "Sector \n Breakdown %", bgcolor = black, text_color = color.white) 
        for i = 0 to array.size(qqq_info3) - 1 
            table.cell(data, 3, 2 + i, text = str.tostring(array.get(sea_info3, i)), bgcolor = black, text_color = color.white) 
            table.cell(data, 4, 2 + i, text = str.tostring(array.get(sea_info4, i)), bgcolor = black, text_color = color.white)

