Crypto Terminal [Kioseff Trading]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KioseffTrading

//@version=5

//  ________________________________________________
// |                                               |  
// |       ---------------------------------       | 
// |      | K̲ i̲ o̲ s̲ e̲ f̲ f̲     T̲ r̲ a̲ d̲ i̲ n̲ g |      | 
// |      |                                 |      |  
// |      | ƃ u ᴉ p ɐ ɹ ꓕ     ⅎ ⅎ ǝ s o ᴉ ꓘ |      |  
// |       --------------------------------        |  
// |                                               | 
// |_______________________________________________|


indicator("Crypto Terminal [Kioseff Trading]", overlay = false, max_lines_count = 500)

import TradingView/ta/2 as ta

tab                     = input.string(defval = "Coin Data #1", title = "Chart Data", options = ["Coin Data #1", "Coin Data #2", "Custom Index", "None"])
plo                     = input.string(defval = "Twitter", title = "Plot Data?", options = 

     [
     
     "Twitter", 
     "Telegram",
     "Whale %",
     "$100,000+ Tx",
     "Bulls/Bears", 
     "Current Position PnL", 
     "Avg. Balance", 
     "Holders/Traders Percentage", 
     "Correlation", 
     "Futures OI", 
     "Perpetual OI", 
     "Zero Balance Addresses",
     "Flow",
     "Active Addresses",
     "Avg. Tx. Time",
     "Realized PnL",
     "Cruisers",
     "None"
     
     ])
     

allIn                   = input.string(defval = "No", title = "Convert All Data to Line Graph?", options = ["No", "Yes"])
hea                     = input.string(defval = "Fixed", title = "Table Header Color Change", options = ["Dynamic", "Fixed"])
txtS                    = input.string(defval = "Normal", title = "Table Text Size", options = ["Auto", "Tiny", "Small", "Normal", "Large", "Huge"], inline = "1")
background              = input.bool(true, title = "Black Background?", inline = "1")
sym1                    = input.symbol(defval = "BTCUSD"  , title = "Symbol 1 ", group = "Custom Crypto Index")
sym2                    = input.symbol(defval = "ETHUSD"  , title = "Symbol 2 ", group = "Custom Crypto Index")
sym3                    = input.symbol(defval = "BNBUSD"  , title = "Symbol 3 ", group = "Custom Crypto Index")
sym4                    = input.symbol(defval = "XRPUSD"  , title = "Symbol 4 ", group = "Custom Crypto Index")
sym5                    = input.symbol(defval = "BUSDUSD" , title = "Symbol 5 ", group = "Custom Crypto Index")
sym6                    = input.symbol(defval = "ADAUSD"  , title = "Symbol 6 ", group = "Custom Crypto Index")
sym7                    = input.symbol(defval = "SOLUSD"  , title = "Symbol 7 ", group = "Custom Crypto Index")
sym8                    = input.symbol(defval = "DOGEUSD" , title = "Symbol 8 ", group = "Custom Crypto Index")
sym9                    = input.symbol(defval = "DOTUSD"  , title = "Symbol 9 ", group = "Custom Crypto Index")
sym10                   = input.symbol(defval = "DAIUSD"  , title = "Symbol 10", group = "Custom Crypto Index")


sZ    = switch txtS
    "Auto"                       => size.auto
    "Tiny"                       => size.tiny
    "Small"                      => size.small
    "Normal"                     => size.normal
    "Large"                      => size.large
    "Huge"                       => size.huge

coinCount                        = matrix.new<float>(40, 5)
coinPos                          = array.new_float(40)
coinNeg                          = array.new_float(40)
coinHi                           = array.new_float(40)
coinLo                           = array.new_float(40)

date(val, Y, M, D) => 
    
    yeaR                         = ta.valuewhen(ta.change(val), Y, 0)
    montH                        = ta.valuewhen(ta.change(val), M, 0)
    daY                          = ta.valuewhen(ta.change(val), D, 0)
    
    [yeaR, montH, daY]
    
[hiTweetY, hiTweetM, hiTweetD]   = date(ta.allTimeHigh(close), year, month, dayofmonth)
[loWhaleY, loWhaleM, loWhaleD]   = date(ta.allTimeLow (close), year, month, dayofmonth)
[hiVolY  , hiVolM  , hiVolD  ]   = date(ta.allTimeHigh(close), year, month, dayofmonth)

strReq() => 
    position                     = str.pos(syminfo.tickerid, ":")
    position1                    = str.contains(syminfo.ticker, "USDT") == true ? str.pos(syminfo.tickerid, "USDT") : str.pos(syminfo.tickerid, "USD") 
    finReq1                      = str.substring(syminfo.tickerid, position + 1, position1)
    finReq1
    

tuple() => 

    [

     close, 
     close > close[1] ? 1 : -1, 
     close > ta.highest(close, 365)[365] ? 1 : 0, 
     close < ta.highest(close, 365)[365] ? 1 : 0, 
     ((close / close[1] - 1) * 100), 
     year >= 2020 ? ((close / ta.allTimeHigh(high) - 1) * 100) : na
     
     ]


req(ticker) => 
    [R, R1, R2, R3, R4, R5] = request.security(ticker, "D", tuple())
    [R, R1, R2, R3, R4, R5]
    
[BTC, BTC1, BTCH, BTCL, BTCR, BTCF      ]                      = req(sym1 ), matrix.set(coinCount, 0 , 0, BTC1), matrix.set(coinCount, 0 , 1, BTCH), matrix.set(coinCount, 0 , 2, BTCL), matrix.set(coinCount,  0 , 3, BTCR), matrix.set(coinCount, 0 , 4, BTCF )                                                                                                                             
[ETH, ETH1, ETHH, ETHL, ETHR, ETHF      ]                      = req(sym2 ), matrix.set(coinCount, 1 , 0, ETH1), matrix.set(coinCount, 1 , 1, ETHH), matrix.set(coinCount, 1 , 2, ETHL), matrix.set(coinCount,  1 , 3, ETHR), matrix.set(coinCount, 1 , 4, ETHF )                                                                                                
[BNB, BNB1, BNBH, BNBL, BNBR, BNBF      ]                      = req(sym3 ), matrix.set(coinCount, 2 , 0, BNB1), matrix.set(coinCount, 2 , 1, BNBH), matrix.set(coinCount, 2 , 2, BNBL), matrix.set(coinCount,  2 , 3, BNBR), matrix.set(coinCount, 2 , 4, BNBF )                                
[XRP, XRP1, XRPH, XRPL, XRPR, XRPF      ]                      = req(sym4 ), matrix.set(coinCount, 3 , 0, XRP1), matrix.set(coinCount, 3 , 1, XRPH), matrix.set(coinCount, 3 , 2, XRPL), matrix.set(coinCount,  3 , 3, XRPR), matrix.set(coinCount, 3 , 4, XRPF )                                
[BIN, BIN1, BINH, BINL, BINR, BINF      ]                      = req(sym5 ), matrix.set(coinCount, 4 , 0, BIN1), matrix.set(coinCount, 4 , 1, BINH), matrix.set(coinCount, 4 , 2, BINL), matrix.set(coinCount,  4 , 3, BINR), matrix.set(coinCount, 4 , 4, BINF )                                
[ADA, ADA1, ADAH, ADAL, ADAR, ADAF      ]                      = req(sym6 ), matrix.set(coinCount, 5 , 0, ADA1), matrix.set(coinCount, 5 , 1, ADAH), matrix.set(coinCount, 5 , 2, ADAL), matrix.set(coinCount,  5 , 3, ADAR), matrix.set(coinCount, 5 , 4, ADAF )                                
[SOL, SOL1, SOLH, SOLL, SOLR, SOLF      ]                      = req(sym7 ), matrix.set(coinCount, 6 , 0, SOL1), matrix.set(coinCount, 6 , 1, SOLH), matrix.set(coinCount, 6 , 2, SOLL), matrix.set(coinCount,  6 , 3, SOLR), matrix.set(coinCount, 6 , 4, SOLF )                                
[DOG, DOG1, DOGH, DOGL, DOGR, DOGF      ]                      = req(sym8 ), matrix.set(coinCount, 7 , 0, DOG1), matrix.set(coinCount, 7 , 1, DOGH), matrix.set(coinCount, 7 , 2, DOGL), matrix.set(coinCount,  7 , 3, DOGR), matrix.set(coinCount, 7 , 4, DOGF )                                
[DOT, DOT1, DOTH, DOTL, DOTR, DOTF      ]                      = req(sym9 ), matrix.set(coinCount, 8 , 0, DOT1), matrix.set(coinCount, 8 , 1, DOTH), matrix.set(coinCount, 8 , 2, DOTL), matrix.set(coinCount,  8 , 3, DOTR), matrix.set(coinCount, 8 , 4, DOTF )                                
[DAI, DAI1, DAIH, DAIL, DAIR, DAIF      ]                      = req(sym10), matrix.set(coinCount, 9 , 0, DAI1), matrix.set(coinCount, 9 , 1, DAIH), matrix.set(coinCount, 9 , 2, DAIL), matrix.set(coinCount,  9 , 3, DAIR), matrix.set(coinCount, 9 , 4, DAIF )                                
[twit, twitB, twitB1, twitB2, twitH     ]                      = request.security("INTOTHEBLOCK:" + strReq() + "_TWITTERPOSITIVE",            "D",  [close  , hiTweetY, hiTweetM, hiTweetD, ta.allTimeHigh(close)             ], ignore_invalid_symbol = true)
[whale, whaleB, whaleB1, whaleB2, whaleL]                      = request.security("INTOTHEBLOCK:" + strReq() + "_WHALESPERCENTAGE",           "D",  [close  , loWhaleY, loWhaleM, loWhaleD, ta.allTimeLow(close)              ], ignore_invalid_symbol = true)
[vol, volB, volB1, volB2, volH, volSma]                        = request.security("INTOTHEBLOCK:" + strReq() + "_LARGETXVOLUMEUSD",           "D",  [close  , hiVolY, hiVolM, hiVolD, ta.allTimeHigh(close), ta.sma(close, 50)], ignore_invalid_symbol = true)
[twitL   , twitLsma   ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_TWITTERNEGATIVE",            "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[twitN   , twitNsma   ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_TWITTERNEUTRAL",             "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[bulls   , bullSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_BULLSVOLUME",                "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[bears   , bearSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_BEARSVOLUME",                "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[loss    , lossSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_INOUTMONEYOUT",              "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[prof    , profSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_INOUTMONEYIN",               "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[even    , evenSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_INOUTMONEYBETWEEN",          "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[avgB    , avgBsma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_AVGBALANCE",                 "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[hodl    , hodlSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_HOLDERSBALANCEPERCENTAGE",   "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[trad    , tradSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_TRADERSBALANCEPERCENTAGE",   "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[corr    , corrSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_BTCCORRELATION30",           "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[oi      , oiSma      ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_FUTURESOPENINTEREST",        "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[perp    , perpSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_PERPETUALOPENINTEREST",      "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[zero    , zeroSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_ZEROBALANCEADDRESSES",       "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[telePos , tpSma      ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_TELEGRAMPOSITIVE",           "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[teleNeg , tnSma      ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_TELEGRAMNEGATIVE",           "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)  
[teleMem , tmSma      ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_TELEGRAMMEMBERS",            "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)                      
[out     , outSma     ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_OUTFLOWTXVOLUMEUSD",         "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[iN      , iNsma      ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_INFLOWTXVOLUMEUSD",          "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[act     , actSma     ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_ACTIVEADDRESSES",            "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[tim     , timSma     ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_AVGTIMEBETWEENTX",           "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[hOut    , hOutSma    ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_BREAKEVENPICEOUT",           "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[hIn     , hInSma     ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_BREAKEVENPICEIN",            "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[hBetween, hBetweenSma]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_BREAKEVENPICEBETWEEN",       "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[cru     , cruSma     ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_CRUISESRSBALANCEPERCENTAGE", "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
[cr1     , cr1Sma     ]                                        = request.security("INTOTHEBLOCK:" + strReq() + "_CRUISESRSPERCENTAGE",        "D",  [close  , ta.sma(close, 50)], ignore_invalid_symbol = true)
// sec                                                            = request.security(syminfo.tickerid, "D", ta.correlation(syminfo.ticker, "BTCUSD", 30))

var float [] avgTwi                                            = array.new_float()
var float [] avgTwil                                           = array.new_float()
var float [] avgTwin                                           = array.new_float()
var float [] avgWha                                            = array.new_float()
var float [] ATHL                                              = array.new_float()
var float [] volA                                              = array.new_float()

calculation() => 
    
    for i = 0 to 39
        
        if matrix.get(coinCount, i, 0) == 1
            array.set(coinPos, i, 1)
        if matrix.get(coinCount, i, 0) == -1
            array.set(coinNeg, i, 1)
        if matrix.get(coinCount, i, 1) == 1
            array.set(coinHi, i, 1)
        if matrix.get(coinCount, i, 2) == 1
            array.set(coinLo, i, 1)

    array.push(volA, vol)
    if array.size(volA) > 50
        array.shift(volA)

    returN          = matrix.submatrix(coinCount, 0, 39, 3, 4)
    belATH          = matrix.submatrix(coinCount, 0, 39, 4, 5)
    calc            = array.sum(coinPos) / array.sum(coinNeg)
    sma1            = ta.sma(array.sum(coinPos), 200)
    sma2            = ta.sma(array.sum(coinNeg), 200)
    calcH           = array.sum(coinHi) 
    calcL           = array.sum(coinLo)
    sma1HL          = ta.sma(array.sum(coinHi), 200)
    sma2HL          = ta.sma(array.sum(coinLo), 200)
    meanMult        = ta.sma(matrix.avg(returN), 50)
    finVol          = array.avg(volA)

    
    [calc, sma1, sma2, calcH, calcL, sma1HL, sma2HL, meanMult, returN, belATH, finVol]
    
[calc, sma1, sma2, calcH, calcL, sma1HL, sma2HL, meanMult, returN, belATH, volFin] = calculation()    

var float [] corrLowHigh = array.new_float()
array.push(avgTwi, twit                    )
array.push(avgTwil, twitL                  )
array.push(avgTwin, twitN                  )
array.push(ATHL, matrix.avg(belATH)        )
array.push(avgWha, whale                   )
array.push(corrLowHigh, corr               )
volCol = vol > volSma ? color.lime : #9dfff5

plot(plo == "Whale %"                    ? whale         : na, color = color.yellow  , style = plot.style_line,                                      title = "Whale %"                                       )       
plot(plo == "$100,000+ Tx"               ? volSma        : na, color = color.white   , style = plot.style_line,                                      title = "100,000$+ Transactions Avg."                   )
plot(plo == "Current Position PnL"       ? loss          : na, color = color.purple  , style = plot.style_line,                                      title = "Current Positions at Loss"                     )                                           
plot(plo == "Current Position PnL"       ? prof          : na, color = color.teal    , style = plot.style_line,                                      title = "Current Positions at Profit"                   )                                        
plot(plo == "Current Position PnL"       ? even          : na, color = color.white   , style = plot.style_line,                                      title = "Current Positions at B/E"                      )                                           
plot(plo == "Avg. Balance"               ? avgB          : na, color = color.red     , style = plot.style_line,                                      title = "Avg. Balance"                                  )                                          
plot(plo == "Holders/Traders Percentage" ? hodl          : na, color = color.olive   , style = plot.style_cross,                                     title = "Holders Balance Percentage"                    )                                           
plot(plo == "Holders/Traders Percentage" ? trad          : na, color = color.maroon  , style = plot.style_cross,                                     title = "Traders Balance Percentage"                    ) 
plot(plo == "Correlation"                ? corr          : na, color = #ff6700       , style = plot.style_line,                                      title = "Correlation to BTC"                            )                                          
plot(plo == "Futures OI"                 ? oi            : na, color = color.aqua    , style = plot.style_line,                                      title = "Futures OI"                                    )                                          
plot(plo == "Perpetual OI"               ? perp          : na, color = color.gray    , style = plot.style_line,                                      title = "Perpetual OI"                                  )                                          
plot(plo == "Zero Balance Addresses"     ? zero          : na, color = color.lime    , style = plot.style_line,                                      title = "Zero Balance Adresses"                         )                                          
plot(plo == "Active Addresses"           ? act           : na, color = #81c784       , style = plot.style_line,                                      title = "Active Addresses"                              )      
plot(plo == "Avg. Tx. Time"              ? tim           : na, color = #5b9cf6       , style = plot.style_line,                                      title = "Average Transaction Time Between Blocks"       )
plot(plo == "Realized PnL"               ? hOut          : na, color = #fccbcd       , style = plot.style_line,                                      title = "Addresses at Realized Loss"                    )
plot(plo == "Realized PnL"               ? hIn           : na, color = #c8e6c9       , style = plot.style_line,                                      title = "Addresses at Realized Profit"                  )
plot(plo == "Realized PnL"               ? hBetween      : na, color = #fff9c4       , style = plot.style_line,                                      title = "Addresses at B/E"                              )
plot(plo == "Bulls/Bears"                ? bullSma       : na, color = color.lime    , style = plot.style_line,                                      title = "Bulls Buying Average"                          )                                           
plot(plo == "Bulls/Bears"                ? bearSma * -1  : na, color = color.red     , style = plot.style_line,                                      title = "Bears Selling Average"                         ) 
plot(plo == "Flow"                       ? outSma  * -1  : na, color = color.red     , style = plot.style_line,                                      title = "Inflow Tx. Volume USD Average"                 ) 
plot(plo == "Flow"                       ? iNsma         : na, color = color.green   , style = plot.style_line,                                      title = "Outflow Tx. Volume USD Average"                )
plot(plo == "Twitter"                    ? twitN         : na, color = color.blue    , style = plot.style_stepline,                                  title = "Twitter Neutral"                               )                                          
plot(plo == "Cruisers"                   ? cru     * 100 : na, color = #e1bee7       , style = plot.style_stepline_diamond,                          title = "% of Assets Belonging to Cruisers"             )      
plot(plo == "Cruisers"                   ? cr1     * 100 : na, color = #fc3278       , style = plot.style_stepline_diamond,                          title = "% of Cruiser Addresses"                        )
plot(plo == "$100,000+ Tx"               ? vol           : na, color = volCol        , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "100,000$+ Transactions"                        )      
plot(plo == "Twitter"                    ? twitL   * -1  : na, color = color.red     , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Twitter Negative"                              ) 
plot(plo == "Twitter"                    ? twit          : na, color = color.lime    , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Twitter Positive"                              )  
plot(plo == "Telegram"                   ? telePos       : na, color = #ffe500       , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Telegram Positive"                             )  
plot(plo == "Telegram"                   ? teleNeg * -1  : na, color = #ff00e8       , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Telegram Negative"                             )  
plot(plo == "Flow"                       ? out     * -1  : na, color = #f77c80       , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Inflow Tx. Volume USD"                         )
plot(plo == "Flow"                       ? iN            : na, color = #4dd0e1       , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Outflow Tx. Volume USD"                        )
plot(plo == "Bulls/Bears"                ? bulls         : na, color = color.orange  , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Bulls Buying"                                  )                                            
plot(plo == "Bulls/Bears"                ? bears   * -1  : na, color = color.fuchsia , style = allIn == "No" ? plot.style_columns : plot.style_line, title = "Bears Selling"                                 )


varip float [] timeColor = array.new_float()
timeSize = array.size(timeColor)

if ta.change(timenow % 16)
    if array.size(timeColor) > 16
        array.clear(timeColor)
    array.push(timeColor, 1)

color col = na

if hea == "Dynamic"
    
    col := 

      timeSize == 0  ? color.lime   : 
      timeSize == 1  ? color.aqua   : 
      timeSize == 2  ? color.black  : 
      timeSize == 3  ? color.blue   : 
      timeSize == 4  ? color.fuchsia: 
      timeSize == 5  ? color.gray   : 
      timeSize == 6  ? color.green  : 
      timeSize == 7  ? color.lime   : 
      timeSize == 8  ? color.maroon : 
      timeSize == 9  ? color.navy   : 
      timeSize == 10 ? color.olive  : 
      timeSize == 11 ? color.orange : 
      timeSize == 12 ? color.purple : 
      timeSize == 13 ? color.red    : 
      timeSize == 14 ? color.silver : 
      timeSize == 15 ? color.teal   : 
      color.yellow
      
else 
    col := color.blue 


        
if barstate.islast
    var table tablePerformance = table.new(position.bottom_right, 20, 20, border_color = color.white, frame_color = color.white, border_width = 1, frame_width = 1)
    
    if tab == "Custom Index"
    
        table.cell(
             
             tablePerformance, 
             0,
             0, 
             text = "Custom Index: Tabular Data ",
             bgcolor = color.new(col, 50),
             text_color = color.white,
             text_size = sZ
             
             )
        
        table.merge_cells(tablePerformance, 0, 0, 1, 0)
        
        
        table.cell(
             
             tablePerformance, 
             0,
             1, 
             text = "ADV-DEC Data",
             bgcolor = color.new(color.white, 50),
             text_color = #000000,
             text_size = sZ

             
             )
        table.merge_cells(tablePerformance, 0, 1, 1, 1)
        table.cell(
             
             tablePerformance, 
             0,
             2, 
             text = "ADV-DEC Ratio: " + str.tostring(calc, "###.###") 
             + " \n(" + str.tostring(array.sum(coinPos), "###") 
             + " Gainers; " 
             + str.tostring(array.sum(coinNeg), "###") 
             + " Losers)",
             bgcolor = array.sum(coinPos) > array.sum(coinNeg) ? color.new(color.green, 90) : color.new(color.red, 90),
             text_color = color.white,
             text_size = sZ

             
             )
    
        table.cell(
             
             tablePerformance, 
             1,
             2, 
             text = "Avg. ADV-DEC Ratio: " + str.tostring(math.round(sma1) / math.round(sma2), "###.###") 
             + " \n(" + str.tostring(math.round(sma1), "###.##")
             + " Avg. Gainers; " 
             + str.tostring(math.round(sma2), "###.##")
             + " Avg. Losers)",
             bgcolor = math.round(sma1) / math.round(sma2) > 1 ? color.new(color.green, 90) : color.new(color.red, 90),
             text_color = color.white,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             0,
             3, 
             text = "Last Year Price",
             bgcolor = color.new(color.white, 50),
             text_color = #000000,
             text_size = sZ
             
             )
        table.merge_cells(tablePerformance, 0, 3, 1, 3)
        
        table.cell(
             
             tablePerformance, 
             0,
             4, 
             text = "Coins Trading Above Last Year High: " + str.tostring(calcH, "###.###") 
             + "\n" + str.tostring("Average: " + str.tostring(math.round(sma1HL), "###.###")),
             bgcolor = calcH > calcL ? color.new(color.green, 90) : color.new(color.red, 90),
             text_color = color.white,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             1,
             4, 
             text = "Coins Trading Below Last Year High: " + str.tostring(calcL, "###.###") 
             + "\n" + str.tostring("Average: " + str.tostring(math.round(sma2HL), "###.###")),
             bgcolor = calcH > calcL ? color.new(color.green, 90) : color.new(color.red, 90),
             text_color = color.white,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             0,
             5, 
             text = "Mean Index Return",
             bgcolor =  color.new(color.white, 50),
             text_color = #000000,
             text_size = sZ
             
             )
        
    
        table.cell(
             
             tablePerformance, 
             0,
             6, 
             text = "Mean Daily Return: " + str.tostring(matrix.avg(returN), format.percent) 
             + "\n50-Session Mean Return: " + str.tostring(meanMult, format.percent),
             bgcolor =  matrix.avg(returN) >= 0.0 ? color.new(color.green, 90) : color.new(color.red, 90),
             text_color = color.white,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             1,
             5, 
             text = "Mean % Below ATH",
             bgcolor =  color.new(color.white, 50),
             text_color = #000000,
             text_size = sZ
             
             )
            
    
        table.cell(
             
             tablePerformance, 
             1,
             6, 
             text = "Mean % Coins Are Trading Below ATH: "+ str.tostring(matrix.avg(belATH), format.percent) 
             + "\nLowest (Since 2020): " + str.tostring(array.min(ATHL), format.percent),
             bgcolor =  color.new(color.yellow, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )
    
    if tab == "Coin Data #1"

        table.cell(
             
             tablePerformance, 
             0,
             4, 
             text = syminfo.description + " Min.Tick Value: " + str.tostring(syminfo.mintick) + " Volume Type: " + syminfo.volumetype,
             bgcolor =  color.new(col, 50) ,
             text_color = color.white,
             text_size = sZ
             
             )
             
        table.merge_cells(tablePerformance, 0, 4, 1, 4)
    
        table.cell(
             
             tablePerformance, 
             0,
             5, 
             text = 
              "Twitter Sentiment",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             )
       
        table.cell(
             tablePerformance, 
             0,
             6, 
             text = 
              "“Positive” Tweets: "+ str.tostring(twit, "###,###") 
             + " (Avg: " + str.tostring(array.avg(avgTwi), "###,###") + ")" 
             + "\n     “Neutral” Tweets : " + str.tostring(twitN, "###,###") 
             + " (Avg: " + str.tostring(array.avg(avgTwin), "###,###") + ")" 
             + "\n“Negative” Tweets : " + str.tostring(twitL, "###,###") 
             + " (Avg :" + str.tostring(array.avg(avgTwil), "###,###") + ")",
             bgcolor =  color.new(#00ffdd, 90) ,
             text_color = color.white,
             text_size = sZ
             )
             
        table.cell(
             
             tablePerformance, 
             1,
             5, 
             text = "Whales",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             1,
             6, 
             text = "Asset % Belonging to Whales : "+ str.tostring(whale * 100, format.percent) 
             + "\nLowest: " + str.tostring(whaleL * 100, format.percent) + " (" + str.tostring(whaleB) + "/" + str.tostring(whaleB1) + "/" + str.tostring(whaleB2) + ")" + 
             "\nTTM Value: " + str.tostring(whale[365] * 100, format.percent),
             bgcolor =  color.new(#fff900, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )    
    
        table.cell(
             
             tablePerformance, 
             0,
             7, 
             text = "Tx. Stats",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             0,
             8, 
             text = "# of $100,000+ Transactions : "+ str.tostring(vol, format.volume) 
             + "\n50-Session Average: " + str.tostring(volFin, format.volume)
             + "\nHighest: " + str.tostring(volH, format.volume) + " (" + str.tostring(volB) + "/" + str.tostring(volB1) + "/" + str.tostring(volB2) + ")",
             bgcolor =  color.new(#00ff20, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )    
    
    
        table.cell(
             
             tablePerformance, 
             1,
             7, 
             text = "Bulls | Bears",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )    
    
        table.cell(
             
             tablePerformance, 
             1,
             8, 
             text = "# of Tokens Bought by Bulls: "+ str.tostring(bulls, format.volume) 
             + "\n# of Tokens Sold by Bears: " + str.tostring(bears, format.volume),
             bgcolor =  color.new(#0006ff, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )
    
        table.cell(
             
             tablePerformance, 
             0,
             9, 
             text = "Open Position Stats",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )    
    
        table.cell(
             
             tablePerformance, 
             0,
             10, 
             text = "Currently Profitable Addresses: "+ str.tostring(prof, format.volume) 
             + "\nCurrently Breakeven Addresses: " + str.tostring(even, format.volume)
             + "\nCurrently Losing Addresses: " + str.tostring(loss, format.volume),
             bgcolor =  color.new(#ff0000, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )
             
        table.cell(
             
             tablePerformance, 
             1,
             9, 
             text = "Holders | Traders",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )
             
    
        table.cell(
             
             tablePerformance, 
             1,
             10, 
             text = "Market Cap Divided by # of Addresses: " + str.tostring(avgB, format.volume) 
             + "\n% of Assets Belonging to Holders: " + str.tostring(hodl * 100, format.percent) 
             +"\n% of Assets Belonging to Traders: " + str.tostring(trad * 100, format.percent),
             bgcolor =  color.new(#ff8100, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )
    
    
        table.cell(
             
             tablePerformance, 
             0,
             11, 
             text = "OI | Correlation | Zero",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )    
    
        table.cell(
             
             tablePerformance, 
             0,
             12, 
             text = "30-Session Correlation to BTC: " + str.tostring(corr * 100, format.percent)
              + "\nFutures OI: " + str.tostring(oi, "###,###.00") 
              + "\nPerpetual OI: " + str.tostring(perp, "###,###.00")
              + "\nZero Balance Adresses: " + str.tostring(zero, "###,###"),
             bgcolor =  color.new(color.purple, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )

        table.cell(
             
             tablePerformance, 
             1,
             11, 
             text = "Telegram",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )

        table.cell(
             
             tablePerformance, 
             1,
             12, 
             text = '"Positive" Telegrams: ' + str.tostring(telePos, "###,###,###") 
             +  '\n"Negative" Telegrams: ' + str.tostring(teleNeg, "###,###,###") 
             +  "\nIf Project Has a TG Channel, \n# Of Members: " + str.tostring(teleMem, "###,###,###") ,
             bgcolor =  color.new(#000000, 90) ,
             text_color = color.white,
             text_size = sZ
             
             )
        
    if tab == "Coin Data #2"

        table.cell(
             
             tablePerformance, 
             0,
             4, 
             text = syminfo.description + " Min.Tick Value: " + str.tostring(syminfo.mintick) + " Volume Type: " + syminfo.volumetype,
             bgcolor =  color.new(col, 50) ,
             text_color = color.white,
             text_size = sZ
             
             )
             
        table.merge_cells(tablePerformance, 0, 4, 1, 4)

  
        table.cell(
             
             tablePerformance, 
             0,
             5, 
             text = "Flow",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )     
  
        table.cell(
             
             tablePerformance, 
             0,
             6, 
             text = "$USD Flowing Out of Withdrawal Addresses: $" + str.tostring(out, format.volume) 
             +  "\n$USD Into Exchanges: $" + str.tostring(iN, format.volume),
             bgcolor =  color.new(color.lime, 50) ,
             text_color = color.white,
             text_size = sZ
             
             )   
             
        table.cell(
             
             tablePerformance, 
             1,
             5, 
             text = "Activity",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )                 
        table.cell(
             
             tablePerformance, 
             1,
             6, 
             text = "Active Addresses: " + str.tostring(act, format.volume) 
             +  "\nAvg. Time Between Transactions: " + str.tostring(tim, "###,###.00") + " Seconds",
             bgcolor =  color.new(color.orange, 50) ,
             text_color = color.white,
             text_size = sZ
             
             )            

        table.cell(
             
             tablePerformance, 
             0,
             7, 
             text = "Realized PnL",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )   
// 
        table.cell(
             
             tablePerformance, 
             0,
             8, 
             text = "# of Addresses With Realized Profits: " + str.tostring(hIn, format.volume) 
             +  "\n# of Addresses With Realized Losses: " + str.tostring(hOut, format.volume) 
             +  "\n# of Addresses at B/E: " + str.tostring(hBetween, format.volume) ,
             bgcolor =  color.new(color.yellow, 50) ,
             text_color = color.white,
             text_size = sZ
             
             )    
             
        table.cell(
             
             tablePerformance, 
             1,
             7, 
             text = "Cruiser Data",
             bgcolor =  color.new(color.white, 50) ,
             text_color = #000000,
             text_size = sZ
             
             )    
        table.cell(
             
             tablePerformance, 
             1,
             8, 
             text = "% of Cruiser Addresses: " + str.tostring(cr1 * 100, format.percent) 
             + "\nTotal % of Assets Belonging to Cruisers: " + str.tostring(cru * 100, format.percent),
             bgcolor =  color.new(color.purple, 50) ,
             text_color = color.white,
             text_size = sZ
             
             )    
    
    var label [] twtL  = array.new_label()
    var line  [] twtLi = array.new_line()

    if plo == "Twitter"
        array.push(twtL, label.new(bar_index + 7, twit, style= label.style_label_left,
                                                 color = color.new(color.lime, 50), 
                                                 text = '"Positive" Tweets\n(' + str.tostring(twit, "###,###") + ")", 
                                                 textcolor = color.white, 
                                                 size =size.small
                                                 ))
        array.push(twtL, label.new(bar_index + 7, twitL * -1, style = label.style_label_left, 
                                                 color = color.new(color.red, 50), 
                                                 text = '"Negative" Tweets\n(' + str.tostring(twitL, "###,###") + ")", 
                                                 textcolor = color.white, 
                                                 size = size.small
                                                 ))
        array.push(twtL, label.new(bar_index + 7, twitN, style = label.style_label_left, 
                                                 color = color.new(color.blue, 50), 
                                                 text = '"Neutral" Tweets\n(' + str.tostring(twitN, "###,###") + ")", 
                                                 textcolor = color.white, 
                                                 size = size.small
                                                 ))
        array.push(twtLi, line.new(bar_index, twit, bar_index + 7, twit,  color = color.lime))
        array.push(twtLi, line.new(bar_index, twitL * -1, bar_index + 7, twitL * -1, color = color.red))
        array.push(twtLi, line.new(bar_index, twitN, bar_index + 7, twitN,  color = color.blue))    
           
        if array.size(twtL) > 3
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 3
            line.delete(array.shift(twtLi))     
            
    if plo == "Whale %"
        array.push(twtL, label.new(bar_index + 7, whale, style= label.style_label_left, 
                                                         color = color.new(color.yellow, 50), 
                                                         text = '% Belonging to Whales\n(' + str.tostring(whale * 100, format.percent) + ")", 
                                                         textcolor = color.white, 
                                                         size =size.small
                                                         ))
        array.push(twtLi, line.new(bar_index, whale, bar_index + 7, whale,  color = color.yellow, style = line.style_dotted))

        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))     
        
        
    if plo == "$100,000+ Tx"
    
        var label [] txLa = array.new_label()
        var line  [] ext  = array.new_line()
        array.push(ext, line.new(bar_index, volSma[1], bar_index + 7, volSma, color = color.white, style = line.style_dotted))
        array.push(txLa, label.new(bar_index + 7, volSma, color = color.white, textcolor = #000000, 
                                                     text = "50-Session Average\n" + str.tostring(math.round(volSma),"###,###"), 
                                                     size = size.small, 
                                                     style = vol > volSma ? 
                                                     label.style_label_up : 
                                                     label.style_label_down
                                                     )) 
        array.push(twtL, label.new(bar_index + 7, vol, style= label.style_label_left, color = color.new(color.green, 50), 
                                                     text = '$100,000+ Txs.\n(' + str.tostring(vol, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, vol, bar_index + 7, vol,  color = color.green, style = line.style_dotted))
        
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))     
        if array.size(txLa) > 1
            label.delete(array.shift(txLa))
        if array.size(ext) > 1
            line.delete(array.shift(ext))

    if plo == "Bulls/Bears"
        array.push(twtL, label.new(bar_index + 7, bulls, style= label.style_label_down, color = color.new(color.orange, 50), 
                                                     text = 'Bulls Buying\n(' + str.tostring(bulls, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, bears * -1, style= label.style_label_up, color = color.new(color.fuchsia, 50), 
                                                     text = 'Bears Selling\n(' + str.tostring(bears, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, bulls, bar_index + 7, bulls,  color = color.orange, style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, bears * -1, bar_index + 7, bears * -1,  color = color.fuchsia, style = line.style_dotted))
        
        if array.size(twtL) > 2
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 2
            line.delete(array.shift(twtLi))
    
    if plo == "Current Position PnL"
    
        array.push(twtL, label.new(bar_index + 7, prof, style= prof > loss ? label.style_label_down : label.style_label_up, color = color.new(color.teal, 50), 
                                                     text = 'Current Positions at Profit\n(' + str.tostring(prof, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, loss, style= prof > loss ? label.style_label_up : label.style_label_down, color = color.new(color.purple, 50), 
                                                     text = 'Current Positions at Loss\n(' + str.tostring(loss, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, even, style= label.style_label_left, color = color.new(color.white, 50), 
                                                     text = 'Current Positions at B/E\n(' + str.tostring(even, format.volume) + ")", 
                                                     textcolor = #000000, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, prof, bar_index + 7, prof,  color = color.teal, style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, loss, bar_index + 7, loss,  color = color.purple,   style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, even, bar_index + 7, even,  color = color.white,  style = line.style_dotted))
        if array.size(twtL) > 3
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 3
            line.delete(array.shift(twtLi))
    if plo == "Avg. Balance"
    
        array.push(twtL, label.new(bar_index + 7, avgB, style= label.style_label_left, color = color.new(color.red, 50), 
                                                     text = 'Average Balance\n(' + str.tostring(avgB, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, avgB, bar_index + 7, avgB,  color = color.red, style = line.style_dotted))
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))
    if plo == "Holders/Traders Percentage"
    
        array.push(twtL, label.new(bar_index + 7, trad, style= label.style_label_left, color = color.new(color.maroon, 50), 
                                                     text = '% Belonging to Traders\n(' + str.tostring(trad * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, hodl, style= label.style_label_left, color = color.new(color.olive, 50), 
                                                     text = '% Belonging to Holders\n(' + str.tostring(hodl * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, trad, bar_index + 7, trad,  color = color.maroon, style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, hodl, bar_index + 7, hodl,  color = color.olive, style = line.style_dotted))
        if array.size(twtL) > 2
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 2
            line.delete(array.shift(twtLi))
    if plo == "Correlation"
    
        array.push(twtL, label.new(bar_index + 7, corr, style= label.style_label_left, color = color.new(#ff6700, 50), 
                                                     text = 'Correlation to BTC\n(' + str.tostring(corr * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, array.min(corrLowHigh), style= label.style_label_up, color = color.new(color.red, 50), 
                                                     text = 'Lowest Correlation\n(' + str.tostring(array.min(corrLowHigh) * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, array.max(corrLowHigh), style= label.style_label_down, color = color.new(color.lime, 50), 
                                                     text = 'Highest Correlation\n(' + str.tostring(array.max(corrLowHigh) * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, corr, bar_index + 7, corr,  color = #ff6700, style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, array.min(corrLowHigh), bar_index + 7, array.min(corrLowHigh),  extend = extend.left, color = color.red, style = line.style_solid))
        array.push(twtLi, line.new(bar_index, array.max(corrLowHigh), bar_index + 7, array.max(corrLowHigh),  extend = extend.left, color = color.lime, style = line.style_solid))
        if array.size(twtL) > 3
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 3
            line.delete(array.shift(twtLi))
              
              
    if plo == "Futures OI"
    
        array.push(twtL, label.new(bar_index + 7, oi, style= label.style_label_left, color = color.new(color.aqua, 50), 
                                                     text = 'Futuires OI\n(' + str.tostring(oi, "###,###,###.00") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, oi, bar_index + 7, oi,  color = color.aqua, style = line.style_dotted))
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))
              
              
    if plo == "Perpetual OI"
    
        array.push(twtL, label.new(bar_index + 7, perp, style= label.style_label_left, color = color.new(color.gray, 50), 
                                                     text = 'Perpetual OI\n(' + str.tostring(perp, "###,###,###.00") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, perp, bar_index + 7, perp,  color = color.gray, style = line.style_dotted))
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))
            
    if plo == "Zero Balance Addresses"
    
        array.push(twtL, label.new(bar_index + 7, zero, style= label.style_label_left, color = color.new(color.lime, 50), 
                                                     text = 'Zero-Bal Addresses\n(' + str.tostring(zero, "###,###,###") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, zero, bar_index + 7, zero,  color = color.lime, style = line.style_dotted))
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))
            
    if plo == "Telegram"
    
        array.push(twtL, label.new(bar_index + 7, telePos, style= label.style_label_down, color = color.new(#ffe500, 50), 
                                                     text = '"Positive" Telegrams\n(' + str.tostring(telePos, "###,###,###") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, teleNeg * -1, style= label.style_label_up, color = color.new(#ff00e8, 50), 
                                                     text = '"Negative" Telegrams\n(' + str.tostring(teleNeg, "###,###,###") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        

        array.push(twtLi, line.new(bar_index, telePos, bar_index + 7, telePos,  color = #ffe500, style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, teleNeg * -1, bar_index + 7, teleNeg * -1,  color = #ff00e8, style = line.style_dotted))
        
        if not na(teleMem)
            array.push(twtL, label.new(bar_index + 50, math.avg(telePos, teleNeg * -1), style= label.style_label_center, color = color.new(#00ffdd, 50), 
                                                         text = "If Project Has a TG Channel, \n# Of Members: " + str.tostring(teleMem, "###,###,###"), 
                                                         textcolor = color.white, 
                                                         size =size.small
                                                         ))        

        if not na(teleMem)
            if array.size(twtL) > 3
                label.delete(array.shift(twtL))
        else 
            if array.size(twtL) > 2
                label.delete(array.shift(twtL))

        if array.size(twtLi) > 2
            line.delete(array.shift(twtLi)) 
    
    if plo == "Flow"
    
        array.push(twtL, label.new(bar_index + 7, iN, style= label.style_label_down, color = color.new(#4dd0e1, 50), 
                                                     text = '$USD Flowing Into Exchanges\n($' + str.tostring(iN, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, iN, bar_index + 7, iN,  color = color.new(#4dd0e1, 50), style = line.style_dotted))
        
        array.push(twtL, label.new(bar_index + 7, out * -1, style= label.style_label_up, color = color.new(#f77c80, 50), 
                                                     text = '$USD Flowing Out of Exchanges\n($' + str.tostring(out, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, out * -1, bar_index + 7, out * -1,  color = color.new(#f77c80, 50), style = line.style_dotted))
        
        
        if array.size(twtL) > 2
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 2
            line.delete(array.shift(twtLi))
    
    if plo == "Active Addresses"
    
        array.push(twtL, label.new(bar_index + 7, act, style= label.style_label_left, color = color.new(#81c784, 50), 
                                                     text = 'Active Addresses\n(' + str.tostring(act, format.volume) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, act, bar_index + 7, act,  color = #81c784, style = line.style_dotted))
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))    
    
    if plo == "Avg. Tx. Time"
    
        array.push(twtL, label.new(bar_index + 7, tim, style= label.style_label_left, color = color.new(#5b9cf6, 50), 
                                                     text = 'Average Transaction Time\n(' + str.tostring(tim, "###,###.####") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, tim, bar_index + 7, tim,  color = #5b9cf6, style = line.style_dotted))
        if array.size(twtL) > 1
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 1
            line.delete(array.shift(twtLi))    

    if plo == "Realized PnL"
    
        array.push(twtL, label.new(bar_index + 7, hIn, style= label.style_label_left, color = color.new(#c8e6c9, 50), 
                                                     text = 'Addresses at Realized Profit\n(' + str.tostring(hIn, "###,###,###") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, hOut, style= label.style_label_left, color = color.new(#fccbcd, 50), 
                                                     text = 'Addresses at Realized Loss\n(' + str.tostring(hOut, "###,###,###") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtL, label.new(bar_index + 7, hBetween, style= label.style_label_left, color = color.new(#fff9c4, 50), 
                                                     text = 'Addresses at B/E\n(' + str.tostring(hBetween, "###,###,###") + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, hIn, bar_index + 7, hIn,  color = #c8e6c9, style = line.style_dotted))
        array.push(twtLi, line.new(bar_index, hOut, bar_index + 7, hOut,  color = #fccbcd, style = line.style_solid))
        array.push(twtLi, line.new(bar_index, hBetween, bar_index + 7, hBetween, color = #fff9c4, style = line.style_solid))
        if array.size(twtL) > 3
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 3
            line.delete(array.shift(twtLi))
              
              
    if plo == "Cruisers"
    
        array.push(twtL, label.new(bar_index + 7, cr1 * 100, style= label.style_label_left, color = color.new(#fc3278, 50), 
                                                     text = '% of Cruiser Addresses\n(' + str.tostring(cr1 * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, cr1 * 100, bar_index + 7, cr1 * 100,  color = color.new(#fc3278, 50), style = line.style_dotted))
        
        array.push(twtL, label.new(bar_index + 7, cru * 100, style= label.style_label_left, color = color.new(#e1bee7, 50), 
                                                     text = 'Total % of Assets Belonging to Cruisers\n(' + str.tostring(cru * 100, format.percent) + ")", 
                                                     textcolor = color.white, 
                                                     size =size.small
                                                     ))
        array.push(twtLi, line.new(bar_index, cru * 100, bar_index + 7, cru * 100,  color = color.new(#e1bee7, 50), style = line.style_dotted))
        
        
        if array.size(twtL) > 2
            label.delete(array.shift(twtL))
        if array.size(twtLi) > 2
            line.delete(array.shift(twtLi))


bgcolor(background == true and plo != "None" ? #000000 : na)


if syminfo.type != "crypto"
    runtime.error("Incalculable Asset. Please Try This Script On a Cryptocurrency.")



