Crypto Map Dashboard v1.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PRO_SMART_Trader

//@version=5


indicator("Crypto Map Dashboard  ⭕📊", overlay=true,max_lines_count=500,scale=scale.none)


// INPUT--------------------------------------------------------------------------------------------------------------------

show_capS =input.bool      (false, "💡Show/Hide Coins MarketCap$", tooltip="Monitor Crypto MarketCap$ (Table1) ",group="️⚙️⚙️⚙️⚙️⚙️⚙️🈁TABLES SSETTING🈁⚙️⚙️⚙️⚙️⚙️⚙️")
show_FLOWS=input.bool      (false, "💡Show/Hide Liquidity Flow$", tooltip="Monitor InFlow$ and OutFlow$ (Table1) ")

Trnsp1    =input.int       (20,"Transparency" ,0,100,10 )
tablesize =input.string    (size.normal, "Tables Size:",[  size.auto, size.tiny, size.small, size.normal, size.large, size.huge])

interval  =input.string    ('Weekly', "Period", options=['4Hour','Daily', 'Weekly', 'Monthly','3Month','6Month','Yearly'], inline='1')

OPTIONAL  =input.string    ("XRP.D","| Dominance For :"  ,["ADA.D","SOL.D","XRP.D","DOGE.D","DOT.D","AVAX.D","LTC.D","ETC.D","ATOM.D","FTT.D","NEAR.D","XMR.D","XLM.D","BCH.D","ALGO.D"], tooltip=("Other Major coins \n position>>top_right_corner") , inline='1')

i_res=interval== "4Hour"?"240": interval== "Daily" ? "1D" : interval== "Weekly"?"1W" : interval== "Monthly"?"1M" :interval== "3Month"?"3M" :interval== "6Month"?"6M":interval== "Yearly"?"12M":interval

// MAJOR DOMINANCES REQUEST-------------------------------------------------------------------------------------------------
BTCD    = math.round(request.security  ("BTC.D"   , i_res, close),2) 
ETHD    = math.round(request.security  ("ETH.D"   , i_res, close),2) 
OTHERSD = math.round(request.security  ("OTHERS.D", i_res, close),2) 
USDTD   = math.round( request.security ("USDT.D"  , i_res, close),2) 
BNBD    = math.round(request.security  ("BNB.D"   , i_res, close),2) 
USDCD   = math.round(request.security  ("USDC.D"  , i_res, close),2) 

// MINOR DOMINANCES REQUEST

XRPD    = math.round(request.security  ("XRP.D" , i_res, close),2) 
ADAD    = math.round(request.security  ("ADA.D" , i_res, close),2) 
SOLD    = math.round(request.security  ("SOL.D" , i_res, close),2) 
TRXD    = math.round(request.security  ("TRX.D" , i_res, close),2) 
DOTD    = math.round(request.security  ("DOT.D" , i_res, close),2) 
DOGED   = math.round(request.security  ("DOGE.D", i_res, close),2) 

OPTD    = math.round(request.security  (OPTIONAL, i_res, close),2) 
// ----------------------------------------------------------------
OTHERSD2= 100-(BTCD+ETHD+OTHERSD+USDTD+BNBD+USDCD)
// ----------------------------------------------------------------
TOTAL     = int (request.security("TOTAL"    , i_res, close)) 
TOTAL2    = int (request.security("TOTAL2"   , i_res, close)) 
TOTAL3    = int (request.security("TOTAL3"   , i_res, close)) 
TOTALDEFI = int (request.security("TOTALDEFI", i_res, close)) 



BTCCAP=(BTCD*TOTAL/100)
ETHCAP=(ETHD*TOTAL/100)
OTHERSCAP=(OTHERSD*TOTAL/100)
USDTCAP=(USDTD*TOTAL/100)
USDCCAP=(USDCD*TOTAL/100) 
BNBCAP=(BNBD*TOTAL/100) 
OPTCAP=(OPTD*TOTAL/100)

// =====================================================================
//funtions (Calculate changes)-------------------------------------------------------------

chng(x,x1) =>
    math.round((x-x1)/x1*100, 2)

    
// ======================================================================================================🈁TABLE🈁=========================================================================================


var Table = table.new(position = position.top_right, columns = 8, rows =8, border_width = 0,bgcolor=color.new(color.white, Trnsp1))

if barstate.islast


    table.cell(table_id = Table, column = 0, row = 0, text = "👁️️ CRYPTO👁️‍🗨️ \n DOMINANCEs"                  , text_size=tablesize,                                                                   tooltip="DominanceS Screener "      )
    table.cell(table_id = Table, column = 1, row = 0, text = " BTC.D % \n "            + str.tostring(BTCD)    , text_size=tablesize, bgcolor=color.new(color.orange, Trnsp1),                        tooltip="Bitcoin "         )
    table.cell(table_id = Table, column = 2, row = 0, text = " ETH.D % \n "            + str.tostring(ETHD)    , text_size=tablesize, bgcolor=color.new(color.blue  , Trnsp1),                        tooltip="Ethereum  "       )  
    table.cell(table_id = Table, column = 3, row = 0, text = " OTHERS.D% \n"           + str.tostring(OTHERSD) , text_size=tablesize,  bgcolor=color.new(color.teal  , Trnsp1),                        tooltip="Others(Altcoins)" )  
    table.cell(table_id = Table, column = 4, row = 0, text = " USDT.D % \n "           + str.tostring(USDTD)   , text_size=tablesize, bgcolor=color.new(color.green , Trnsp1),                        tooltip="Tether "          )
    table.cell(table_id = Table, column = 5, row = 0, text = " USDC.D % \n "           + str.tostring(USDCD)   , text_size=tablesize, bgcolor=color.new(color.lime  , Trnsp1),                        tooltip="USD Coin "        )
    table.cell(table_id = Table, column = 6, row = 0, text = " BNB.D % \n "            + str.tostring(BNBD)    , text_size=tablesize, bgcolor=color.new(color.yellow, Trnsp1),                        tooltip="Binance Coin "    )
    table.cell(table_id = Table, column = 7, row = 0, text =   OPTIONAL +"% \n"        + str.tostring(OPTD)    , text_size=tablesize,text_color=color.white,bgcolor=color.new(color.black, Trnsp1),tooltip="Other Major Coin"          )

// // ------------------------------------------
   

// // ------------------------------------------

    table.cell(table_id = Table, column = 0, row =1, text = "🔺Change ("+interval+")\n\n 🔻Change (" +interval +")%" , bgcolor=color.new(color.red, Trnsp1)                                                    ,text_size=tablesize                                                                                           )
    table.cell(table_id = Table, column = 1, row =1, text = str.tostring(math.round(chng(BTCD,BTCD[1])*BTCD[1]/100 ,2         ))         +" \n -------- \n " +str.tostring(chng(BTCD,BTCD[1]      ))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(BTCD,BTCD[1])>=0?      color.green:color.red    )
    table.cell(table_id = Table, column = 2, row =1, text = str.tostring(math.round(chng(ETHD,ETHD[1])*ETHD[1]/100,2          ))         +" \n -------- \n " +str.tostring(chng(ETHD,ETHD[1]      ))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(ETHD,ETHD[1])>=0?      color.green:color.red    )
    table.cell(table_id = Table, column = 3, row =1, text = str.tostring(math.round(chng(OTHERSD,OTHERSD[1])*OTHERSD[1]/100 ,2))         +" \n -------- \n " +str.tostring(chng(OTHERSD,OTHERSD[1]))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(OTHERSD,OTHERSD[1])>=0?color.green:color.red    )
    table.cell(table_id = Table, column = 4, row =1, text = str.tostring(math.round(chng(USDTD,USDTD[1])*USDTD[1]/100,2       ))         +" \n -------- \n " +str.tostring(chng(USDTD,USDTD[1]    ))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(USDTD,USDTD[1])>=0?    color.green:color.red    )
    table.cell(table_id = Table, column = 5, row =1, text = str.tostring(math.round(chng(USDCD,USDCD[1])*USDCD[1]/100,2       ))         +" \n -------- \n " +str.tostring(chng(USDCD,USDCD[1]    ))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(USDCD,USDCD[1])>=0?    color.green:color.red    )
    table.cell(table_id = Table, column = 6, row =1, text = str.tostring(math.round(chng(BNBD,BNBD[1])*BNBD[1]/100,2          ))         +" \n -------- \n " +str.tostring(chng(BNBD,BNBD[1]      ))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(BNBD,BNBD[1])>=0?      color.green:color.red    )
    table.cell(table_id = Table, column = 7, row =1, text = str.tostring(math.round(chng(OPTD,OPTD[1])*OPTD[1]/100,2          ))         +" \n -------- \n " +str.tostring(chng(OPTD,OPTD[1]      ))+       "  %" ,text_size=tablesize, text_size=tablesize, text_color=chng(OPTD,OPTD[1])>=0?      color.green:color.red    )

// -------------------------------------------------------------------------------------------------------------------------------------
    if show_capS
        table.cell(table_id = Table, column = 0, row = 2, text = " 💹Market Cap$💵 " ,width=9,tooltip="MarketCap$ Screener "                                                                              ,text_size=tablesize)
        table.cell(table_id = Table, column = 1, row = 2, text ="$"+ str.tostring(math.round((BTCCAP)/1000000000    ,3))     +" B"     ,                          bgcolor=color.new(color.orange, Trnsp1),text_size=tablesize)
        table.cell(table_id = Table, column = 2, row = 2, text ="$"+ str.tostring(math.round((ETHCAP)/1000000000    ,3))     +" B"     ,                          bgcolor=color.new(color.blue  , Trnsp1),text_size=tablesize)  
        table.cell(table_id = Table, column = 3, row = 2, text ="$"+ str.tostring(math.round((OTHERSCAP)/1000000000 ,3))     +" B"     ,                          bgcolor=color.new(color.teal  , Trnsp1),text_size=tablesize)  
        table.cell(table_id = Table, column = 4, row = 2, text ="$"+ str.tostring(math.round((USDTCAP)/1000000000   ,3))     +" B"     ,                          bgcolor=color.new(color.green , Trnsp1),text_size=tablesize)
        table.cell(table_id = Table, column = 5, row = 2, text ="$"+ str.tostring(math.round((USDCCAP)/1000000000   ,3))     +" B"     ,                          bgcolor=color.new(color.lime  , Trnsp1),text_size=tablesize)
        table.cell(table_id = Table, column = 6, row = 2, text ="$"+ str.tostring(math.round((BNBCAP)/1000000000    ,3))     +" B"     ,                          bgcolor=color.new(color.yellow, Trnsp1),text_size=tablesize)
        table.cell(table_id = Table, column = 7, row = 2, text ="$"+ str.tostring(math.round((OPTCAP)/1000000000    ,3))     +" B"     , text_color=color.white,bgcolor=color.new(color.black, Trnsp1),text_size=tablesize)




 

    
    if show_FLOWS

        table.cell(table_id = Table, column = 0, row = 3, text = "🔄Market Flow$💸\n("+(interval)+")"  ,  bgcolor=color.new(color.rgb(208, 129, 117) , Trnsp1),tooltip="InFlow$ and OutFlow$ Screener "                                     ,text_size=tablesize                                                                     )

        table.cell(table_id = Table, column = 1, row = 3, text ="$"+ str.tostring(int(chng(BTCCAP,BTCCAP[1])*BTCCAP[1]/100000)          /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(BTCCAP,BTCCAP[1]      ))+       "  %"        ,text_size=tablesize,text_color=chng(BTCCAP,BTCCAP[1])>=0?      color.green:color.red)
        table.cell(table_id = Table, column = 2, row = 3, text ="$"+ str.tostring(int(chng(ETHCAP,ETHCAP[1])*ETHCAP[1]/100000)          /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(ETHCAP,ETHCAP[1]      ))+       "  %"        ,text_size=tablesize,text_color=chng(ETHCAP,ETHCAP[1])>=0?      color.green:color.red)  
        table.cell(table_id = Table, column = 3, row = 3, text ="$"+ str.tostring(int(chng(OTHERSCAP,OTHERSCAP[1])*OTHERSCAP[1]/100000) /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(OTHERSCAP,OTHERSCAP[1]))+       "  %"        ,text_size=tablesize,text_color=chng(OTHERSCAP,OTHERSCAP[1])>=0?color.green:color.red)  
        table.cell(table_id = Table, column = 4, row = 3, text ="$"+ str.tostring(int(chng(USDTCAP,USDTCAP[1])*USDTCAP[1]/100000 )      /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(USDTCAP,USDTCAP[1]    ))+       "  %"        ,text_size=tablesize,text_color=chng(USDTCAP,USDTCAP[1])>=0?    color.green:color.red)
        table.cell(table_id = Table, column = 5, row = 3, text ="$"+ str.tostring(int(chng(USDCCAP,USDCCAP[1])*USDCCAP[1]/100000 )      /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(USDCCAP,USDCCAP[1]    ))+       "  %"        ,text_size=tablesize,text_color=chng(USDCCAP,USDCCAP[1])>=0?    color.green:color.red)
        table.cell(table_id = Table, column = 6, row = 3, text ="$"+ str.tostring(int(chng(BNBCAP,BNBCAP[1])*BNBCAP[1]/100000 )         /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(BNBCAP,BNBCAP[1]      ))+       "  %"        ,text_size=tablesize,text_color=chng(BNBCAP,BNBCAP[1])>=0?      color.green:color.red)
        table.cell(table_id = Table, column = 7, row = 3, text ="$"+ str.tostring(int(chng(OPTCAP,OPTCAP[1])*OPTCAP[1]/100000 )         /1000 )     +" M"  +" \n -------- \n " +str.tostring(chng(OPTCAP,OPTCAP[1]      ))+       "  %"        ,text_size=tablesize,text_color=chng(OPTCAP,OPTCAP[1])>=0?      color.green:color.red)




// // // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// // // ---------------------------------------------------bottom right Table---------------------------------------------------------------------------------------------------
// // // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------

var Table1 = table.new(position =  position.bottom_right, columns =5, rows =3, border_width = 0,bgcolor=color.new(color.black, Trnsp1))


if barstate.islast

    table.cell(table_id = Table1, column = 0, row = 0, text  = " 👁️ CRYPTO👁️‍🗨️ \n TOTALs CAP$"  , bgcolor=color.new(color.rgb(88, 88, 88), Trnsp1) ,text_size=tablesize  ,text_color=color.white                                                               ,tooltip="Crypto Total MarketCap$ Screener "    )     
    table.cell(table_id = Table1, column = 1, row = 0, text  = " TOTAL:\n $ "                    + str.tostring (math.round((TOTAL/1000000000    ),3))     +" B"         ,text_size=tablesize  ,text_color=color.white,bgcolor=color.new(#000080, Trnsp1),tooltip=" Total MarkcetCap"                    )
    table.cell(table_id = Table1, column = 2, row = 0, text  = " TOTAL2:\n $ "                   + str.tostring(math.round((TOTAL2/1000000000   ),3))     +" B"         ,text_size=tablesize  ,text_color=color.white,bgcolor=color.new(#0000CD, Trnsp1),tooltip=" Total MarkcetCap Exclude BTC"        )  
    table.cell(table_id = Table1, column = 3, row = 0, text  = " TOTAL3:\n $ "                   + str.tostring(math.round((TOTAL3/1000000000   ),3))     +" B"         ,text_size=tablesize  ,text_color=color.white,bgcolor=color.new(#4169E1, Trnsp1),tooltip=" Total MarkcetCap Exclude BTC & ETH " )  
    table.cell(table_id = Table1, column = 4, row = 0, text  = " TOTALDEFI:\n $ "                + str.tostring(math.round((TOTALDEFI/1000000000),3))     +" B"         ,text_size=tablesize  ,text_color=color.white,bgcolor=color.new(#6495ED, Trnsp1),tooltip=" Total DeFi MarkcetCap"               )  


    table.cell(table_id = Table1, column = 0, row =1, text = "🔺Change ("+interval+")\n\n 🔻Change (" +interval +")%" , bgcolor=color.new(color.red, Trnsp1),text_color=color.white                                                                                                                 ,text_size=tablesize)
   
    table.cell(table_id = Table1, column = 1, row =1, text ="$ " +   str.tostring(math.round((chng(TOTAL,TOTAL[1])*TOTAL[1]/100 /1000000000           ),3))     +" B\n -------- \n " +str.tostring(chng(TOTAL,TOTAL[1]        ))        +"  %" ,text_color=chng(TOTAL,TOTAL[1])        >=0?color.green:color.red,text_size=tablesize)
   
    table.cell(table_id = Table1, column = 2, row =1, text ="$ " +   str.tostring(math.round((chng(TOTAL2,TOTAL2[1])*TOTAL2[1]/100 /1000000000        ),3))     +" B\n -------- \n " +str.tostring(chng(TOTAL2,TOTAL2[1]      ))        +"  %" ,text_color=chng(TOTAL2,TOTAL2[1])      >=0?color.green:color.red,text_size=tablesize)
   
    table.cell(table_id = Table1, column = 3, row =1, text ="$ " +   str.tostring(math.round((chng(TOTAL3,TOTAL3[1])*TOTAL3[1]/100 /1000000000        ),3))     +" B\n -------- \n " +str.tostring(chng(TOTAL3,TOTAL3[1]      ))        +"  %" ,text_color=chng(TOTAL3,TOTAL3[1])      >=0?color.green:color.red,text_size=tablesize)
   
    table.cell(table_id = Table1, column = 4, row =1, text ="$ " +   str.tostring(math.round((chng(TOTALDEFI,TOTALDEFI[1])*TOTALDEFI[1]/100/1000000000),3))     +" B\n -------- \n " +str.tostring(chng(TOTALDEFI,TOTALDEFI[1]))+"  %"         ,text_color=chng(TOTALDEFI,TOTALDEFI[1])>=0?color.green:color.red,text_size=tablesize)





// // // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// // // --------------------------------------------------------------⭕PIE CHART______DONUT CHART⭕----------------------------------------------------------------------------------------------
// // // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------



Pie_Donut_chart =input.bool(false, "💡(PIE_DONUT) CHART", group="️⚙️⚙️️⚙️️️️️⚙️⚙️⭕️️pie & Donut Chart setting⭕️️⚙️⚙️⚙️⚙️️⚙️️️")

Show1     = input.bool(false, "💡Show/Hide labels and details "                      ,tooltip="Monitor dominances on Pie chart 🔰\nif you also want to  see a Donut Chart form just increace the insider Radius  "                                                                          ,inline="2")
r         = input.int (0    ,"*Inside radius*  ",minval=0,maxval=50,step=10                                                                                                                                                                                                                 ,inline="3")
R         = input.int (120  ,"*Outside radius*",minval=80,maxval=200,step=10         ,tooltip="🔘 Radius of insider and outer circle  \nNOTE🔰\n*If this larger radius exceeds the allowed limit,\nthe chart may disappear So, to solve this problem, shift the graph to the leftside *👇"  ,inline="3")
w         = input.int (10   ,"|Overlap|",minval=0,maxval=10,step=2                                                                                                                                                                                                                          ,inline="4")
p_x       = input.int (-50  ,"<<==Shift==>> " ,step=50                               ,tooltip="Overlap:Lines Thickness \n shift: (-)shift to leftside _OR_ rightside(+) "                                                                                                                   ,inline="4")



//color partition on circle

C1=int(BTCD*360/100        )
C2=int( C1+(ETHD*360/100)  )
C3=int(C2+(OTHERSD*360/100))
C4=int (C3+(USDTD*360/100) )
C5=int(C4+(USDCD*360/100)  )
C6=int(C5+(BNBD*360/100)   )
C7=int(C6+(OPTD*360/100)   )



// Pie_chart ======================================================================================================================================================================

color CLR= na
for i  = 0 to 360 by 1
    x0 =int( r*math.sin(math.toradians(i)))
    y0 =int( r*math.cos(math.toradians(i)))
    x  =int( R*math.sin(math.toradians(i)))
    y  =int( R*math.cos(math.toradians(i)))
    
    CLR:=( i<C1 ? color.orange : i<C2 ? color.blue: i< C3? color.teal:i<C4 ? color.green:i<C5?color.lime:i<C6?color.yellow: color.fuchsia)

    if barstate.islast and Pie_Donut_chart
    
        line = line.new(bar_index+p_x+R+x0 , close+y0  , bar_index+p_x+ x+R, close + y        , color= CLR        ,style= w==0? line.style_arrow_right:line.style_solid, extend = extend.none, width=w                                                                )
        
        L1   =label.new(bar_index+p_x+R    ,close      ,"Crypto Dominance \n🔎Distribution🔍" , color=color.black	,style=label.style_label_center,textcolor=color.yellow,textalign=text.align_center,size=size.small,tooltip="🔴Pie chart or \n⭕Dounat chart \n     👆👆⚙️✅")
       


// Pie_chart
//------------------------------ showing lables and details on Pie_chart-----------------------------------------------
 
if Show1  and Pie_Donut_chart

    L2=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians(C1/2)))     ,close+ int( (r+R)/2*math.cos(math.toradians(C1/2)))     ,"BTC.D = "+ str.tostring(BTCD)          +  " %" ,style= label.style_none,textcolor=color.white           ,textalign=text.align_center                       ,size=size.large ,tooltip="👑Bitcoin  Dominance")
    label.delete(L2[1])

    L3=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C1+C2)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C1+C2)/2))) ,"ETH.D = "+ str.tostring(ETHD)         +  " %" ,style= label.style_none,textcolor=color.white           ,textalign=text.align_center                       ,size=size.normal,tooltip="💎Ethereum  Dominance")
    label.delete(L3[1])

    L4=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C2+C3)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C2+C3)/2))) ,"OTHERS.D = "+ str.tostring(OTHERSD)   +  " %" ,style= label.style_none,textcolor=color.white           ,textalign=text.align_center                       ,size=size.normal,tooltip="Others Dominance \n(🚀Minor Altcoins)" )
    label.delete(L4[1])

    L5=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C3+C4)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C3+C4)/2))) ,"    USDT.D = "+ str.tostring(USDTD)   +  " %" ,style= label.style_label_right,color=color.navy         ,textcolor=color.white,textalign=text.align_center ,size=size.small ,tooltip="Tether Dominance")
    label.delete(L5[1])

    L6=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C4+C5)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C4+C5)/2))) ,"USDC.D = "+ str.tostring(USDCD)       +  " %" ,style= label.style_label_right,color=color.navy         ,textcolor=color.white,textalign=text.align_center ,size=size.small ,tooltip="USD Coin Dominance")
    label.delete(L6[1])

    L7=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C5+C6)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C5+C6)/2))) ,"BNB.D = "+ str.tostring(BNBD)         +  " %" ,style=  label.style_label_lower_right,color=color.gray ,textcolor=color.white,textalign=text.align_center ,size=size.small  ,tooltip="Binance Coin Dominance")
    label.delete(L7[1])

    // L8=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C6+C7)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C6+C7)/2))) ,OPTIONAL+" = " + str.tostring(OPTD) +  " %" ,style=  label.style_label_lower_right,color=color.black,textcolor=color.white,textalign=text.align_center ,size=size.small)
    // label.delete(L8[1])

    L8=label.new(bar_index+p_x+R+ int( (r+R)/2*math.sin(math.toradians((C6+360)/2))),close+ int( (r+R)/2*math.cos(math.toradians((C6+360)/2))),"📍The rest: "+ str.tostring(OTHERSD2)    +  " %" ,style= label.style_label_down,color=color.maroon       ,textcolor=color.white,textalign=text.align_center ,size=size.normal ,tooltip=("🔅Other Major coins:🔰\n ADA.D ="+ str.tostring(ADAD)
     +  "%\n SOL.D ="+ str.tostring(SOLD) +  " % " +  "\n XRP.D ="+ str.tostring(XRPD) +  " % \n "+  "DOGE.D =" + str.tostring(DOGED) +  " %  \n"+     " TRX.D ="+ str.tostring(TRXD) +  " %\n  "+  "DOT.D ="+ str.tostring(DOTD) +  " % \n +... "))
    label.delete(L8[1])





// ===========================================📊Column chart📊==========================================================================================================================================




// variables and inputs----------------------------------------------------------------------------------------------------
Column_chart = input.bool(false, "💡 Column chart",group="️⚙️⚙️️⚙️⚙️⚙️⚙️️📊Column chart setting📊⚙️️⚙️⚙️⚙️⚙️️⚙️"        )  
Show2        = input.bool(false, "💡Show/Hide labels and details  ", tooltip="Monitor TOTALs details on Column chart")


var ATHT=3009000000000
ATHT    := TOTAL> ATHT ? TOTAL:ATHT

var ATHT2=1707000000000
ATHT2   := TOTAL2> ATHT2 ? TOTAL2:ATHT2

var ATHT3=1131000000000
ATHT3   := TOTAL3> ATHT3 ? TOTAL3:ATHT3

var ATHTDEFI=199481000000
ATHTDEFI:= TOTALDEFI> ATHTDEFI ? TOTALDEFI:ATHTDEFI

TOP   =close+R/2
BOTTOM=close-R/1.5
H     =7/6*R


H3T   = H- ( H*9/3009)
// ===================================================================================================================
if barstate.islast and Column_chart
// ==================================================lines============================================================

    ll =line.new(bar_index+p_x+20+ 2*R ,  BOTTOM, bar_index+20 + p_x+2*R, TOP+R/6 , color=color.black,style=line.style_arrow_right, width=3)
    lll=line.new(bar_index+p_x+20+ 2*R ,  BOTTOM, bar_index+300+ p_x+2*R, BOTTOM  , color=color.black,style=line.style_arrow_right, width=3)
//   ------------------------------------------
    l_05T=line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/6  , bar_index+270+ p_x+2*R, BOTTOM+ H3T/6   ,color=color.white,style= line.style_dashed, width=1)
    l_1T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3  , bar_index+270+ p_x+2*R, BOTTOM+ H3T/3   ,color=color.white,style= line.style_dashed, width=1)
    l_2T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*2, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*2 ,color=color.white,style= line.style_dashed, width=1)
    l_3T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T    , bar_index+270+ p_x+2*R, BOTTOM+ H3T     ,color=color.white,style= line.style_dashed, width=1)
    
    // l_4T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*4, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*4 ,color=color.white,style= line.style_dashed, width=1   )
    // l_5T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*5, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*5 ,color=color.white,style= line.style_dashed, width=1   )
    // l_6T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*6, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*6 ,color=color.white,style= line.style_dashed, width=1   )
    // l_7T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*7, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*7 ,color=color.white,style= line.style_dashed, width=1   )
    // l_8T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*8, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*8 ,color=color.white,style= line.style_dashed, width=1   )
    // l_9T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*9, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*9 ,color=color.white,style= line.style_dashed, width=1   )
    // l_10T =line.new(bar_index+p_x+10+ 2*R , BOTTOM+ H3T/3*10, bar_index+270+ p_x+2*R, BOTTOM+ H3T/3*10 ,color=color.white,style= line.style_dashed, width=1)

// ==================================================BOXES============================================================

    BOX_total    =box.new(bar_index+p_x+30+ 2*R , BOTTOM+H*(TOTAL/ATHT)    , bar_index+p_x+70+ 2*R ,BOTTOM, border_color=color.white,border_width=2, border_style=line.style_dotted, bgcolor=color.new(#000080, 0),text= Show2 ? (str.tostring(math.round((TOTAL/ATHT *100),2))+"%\n of ATH"):"📊?"         ,text_size=size.normal, text_color=color.white, text_valign=text.align_top) 
     
    BOX_total2   =box.new(bar_index+p_x+90+ 2*R , BOTTOM+H*(TOTAL2/ATHT)   , bar_index+p_x+130+ 2*R,BOTTOM, border_color=color.white,border_width=2, border_style=line.style_dotted, bgcolor=color.new(#0000CD, 0),text=Show2 ?(str.tostring(math.round((TOTAL2/ATHT2 *100),2))+"%\n of ATH"):"📊?"         ,text_size=size.normal, text_color=color.white, text_valign=text.align_top) 
     
    BOX_total3   =box.new(bar_index+p_x+150+ 2*R, BOTTOM+H*(TOTAL3/ATHT)   , bar_index+p_x+190+ 2*R,BOTTOM, border_color=color.white,border_width=2, border_style=line.style_dotted, bgcolor=color.new(#4169E1, 0),text=Show2 ?(str.tostring(math.round((TOTAL3/ATHT3 *100),2))+"%\n of ATH"):"📊?"         ,text_size=size.normal, text_color=color.white, text_valign=text.align_top) 
     
    BOX_totaldefi=box.new(bar_index+p_x+210+ 2*R, BOTTOM+H*(TOTALDEFI/ATHT), bar_index+p_x+250+ 2*R,BOTTOM, border_color=color.white,border_width=2, border_style=line.style_dotted, bgcolor=color.new(#6495ED,0) ,text=Show2 ?(str.tostring(math.round((TOTALDEFI/ATHTDEFI *100),2))+"%\n of  ATH"):"📊?"  ,text_size=size.small , text_color=color.white, text_valign=text.align_top) 
     
     
  
// ==================================================Labels and details============================================================
     
  
    L10=label.new(bar_index+p_x+20+ 2*R , BOTTOM-R/10,"TOTALs CAP$\n🔎 Comparison 🔍" , color=color.new(color.white, 30),style=label.style_label_center,textcolor=color.black,textalign=text.align_center,size=size.small,tooltip="📊Column chart\n  👆👆⚙️✅")
   
   
    if Show2 
  
        L11=label.new( bar_index+p_x+50 + 2*R, TOP                       ,"ATH ",style= label.style_label_down,color=color.new(color.red, 50),textcolor=color.black,textalign=text.align_center,size=size.normal,tooltip="TOTAL \n All Time High    = $ "   + str.tostring(ATHT/1000000000000) +" T"    )
    
        L12=label.new( bar_index+p_x+110+ 2*R, BOTTOM+H*(ATHT2/ATHT)     ,"ATH ",style= label.style_label_down,color=color.new(color.red, 50),textcolor=color.black,textalign=text.align_center,size=size.small ,tooltip="TOTAL2 \nAll Time High    = $ "   + str.tostring(ATHT2/1000000000000) +" T"   )
    
        L13=label.new( bar_index+p_x+170+ 2*R, BOTTOM+H*(ATHT3/ATHT)     ,"ATH ",style= label.style_label_down,color=color.new(color.red, 50),textcolor=color.black,textalign=text.align_center,size=size.small ,tooltip="TOTAL3 \nAll Time High    = $ "   + str.tostring(ATHT3/1000000000000) + " T"  )
    
        L14=label.new( bar_index+p_x+230+ 2*R, BOTTOM+H*(ATHTDEFI/ATHT)  ,"ATH ",style= label.style_label_down,color=color.new(color.red, 50),textcolor=color.black,textalign=text.align_center,size=size.small ,tooltip="TOTALDEFI \nAll Time High = $ "   + str.tostring(ATHTDEFI/1000000000)+" B"    )
//  --------------------------------------------------------------------------
// 
        lABLE_05T=label.new(bar_index+270+ p_x+2*R , BOTTOM+ H3T/6       ,style= label.style_diamond,color=color.new(color.red,0),textcolor=color.yellow,textalign=text.align_center,size=size.tiny  ,tooltip="$500 B "            )
        lABLE_1T=label.new (bar_index+270+ p_x+2*R , BOTTOM+ H3T/3       ,style= label.style_diamond,color=color.new(color.red,0),textcolor=color.yellow,textalign=text.align_center,size=size.small ,tooltip="$1 T "              )
        lABLE_2T=label.new (bar_index+270+ p_x+2*R , BOTTOM+ H3T/3*2     ,style= label.style_diamond,color=color.new(color.red,0),textcolor=color.yellow,textalign=text.align_center,size=size.normal ,tooltip="$2 T "              )
        lABLE_3T=label.new (bar_index+270+ p_x+2*R , BOTTOM+ H3T ,"$3 T" ,style= label.style_flag   ,color=color.new(color.red,0),textcolor=color.yellow,textalign=text.align_center,size=size.normal,tooltip="3 Trillion Dollar"  )
    
    
    
    
//  --------------------------------------------------------------------------------------_END_----------------------------------------------------------------------------------------------------------------
//   =============================================================================================================================================================================================================