Price on chart Binance  spot USDT and  Bybit perpetual USDT.P.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © hussarya

//@version=5
indicator(title="Price Binance  spot USDT and  Bybit perpetual USDT.P.", overlay=true)

// dane aktywa

nazwa = syminfo.basecurrency 
gielda = syminfo.prefix
waluta = syminfo.currency

ticker0 = syminfo.tickerid
ticker1 = "BINANCE:" + nazwa + "USDT"
ticker2 = "BYBIT:" + nazwa + "USDT.P"

timeframe = timeframe.period

kolor0 = color.black
kolor1 = color.rgb(197, 246, 198)
kolor2 = color.rgb(208, 230, 249)
kolor3 = color.rgb(247, 230, 205)
//spot = input.symbol( "BINANCE:AAVEUSDT" , "Symbol" )
//bybit = input.symbol("Bybit:AAVEUSDT.P", "Symbol" )

spot_close = request.security(ticker1, timeframe ,  close)
spot_open = request.security(ticker1, timeframe ,  open)
spot_high = request.security(ticker1, timeframe ,  high)
spot_low = request.security(ticker1, timeframe ,  low)
spot_volume = request.security(ticker1, timeframe ,  volume)

bybit_close = request.security(ticker2, timeframe ,  close)
bybit_open = request.security(ticker2, timeframe ,  open)
bybit_high = request.security(ticker2, timeframe ,  high)
bybit_low = request.security(ticker2, timeframe ,  low)
bybit_volume = request.security(ticker2, timeframe ,  volume)


plotcandle(spot_open, spot_high, spot_low, spot_close, title = "Binance SPOT",  color = color.blue, wickcolor = color.blue, bordercolor = color.blue)


plotcandle(bybit_open, bybit_high, bybit_low, bybit_close, title = "BYBIT Perpetual",  color = color.orange, wickcolor = color.orange, bordercolor = color.orange)



var mytable = table.new(position = position.top_right, columns = 3, rows = 3, bgcolor = kolor1, border_width = 1 , frame_color = kolor0, frame_width = 1, border_color = kolor0)


//pierwsza kolumna
table.cell(table_id = mytable,column =0, row=0, text = "Base chart currency  ticker ID", text_color = kolor0,bgcolor = kolor1)
table.cell(table_id = mytable,column =0, row=1, text = "Binance SPOT  ticker  ID", text_color = kolor0,bgcolor = kolor2)
table.cell(table_id = mytable,column =0, row=2, text = "BYBIT ticker ID", text_color = kolor0 ,bgcolor = kolor3)


//2 kolumna
table.cell(table_id = mytable,column =1, row=0, text = str.tostring(ticker0), text_color = kolor0,bgcolor = kolor1)
table.cell(table_id = mytable,column =1, row=1, text = str.tostring(ticker1), text_color = kolor0,bgcolor = kolor2)
table.cell(table_id = mytable,column =1, row=2, text = str.tostring(ticker2), text_color = kolor0,bgcolor = kolor3)

//3 kolumna
table.cell(table_id = mytable,column =2, row=0, text ="volume:  " + str.tostring( volume), text_color = kolor0,bgcolor = kolor1)
table.cell(table_id = mytable,column =2, row=1, text ="volume:  " + str.tostring(spot_volume), text_color = kolor0,bgcolor = kolor2)
table.cell(table_id = mytable,column =2, row=2, text ="volume:  " + str.tostring(bybit_volume), text_color = kolor0,bgcolor = kolor3)
