Arbitrage Dashboard

ARBITRAGE

Mit diesem Indikator können Sie den Spread (Wechselkursunterschied) zwischen zwei Vermögenswerten in Echtzeit für bis zu 12 Handelspaare gleichzeitig überwachen.

Airbitrage Dashboard

Im Einstellungsmenü können Sie zwei Handelspaare auswählen, z. B. BTCUSDT auf Binance und BTCUSDT auf Bybit. Das Skript ruft dann die Preise von beiden Börsen ab, vergleicht sie und berechnet die prozentuale Differenz (Spread). Dieser Vorgang wird für alle 12 in den Einstellungen hinzugefügten Handelspaare wiederholt. Das Skript funktioniert nur mit den auf TradingView verfügbaren Vermögenswerten und Börsen.

Wenn der Spread negativ ist, bedeutet dies, dass der Preis des Vermögenswerts an der ersten Börse niedriger ist als an der zweiten. Indem Sie an der ersten Börse kaufen und an der zweiten verkaufen, können Sie einen Gewinn erzielen (unter Berücksichtigung der Börsengebühren). Wenn der Spread positiv ist, ist das Gegenteil der Fall. Die Kaufpreise und Börsen werden in einer grünen Kaufzeile angezeigt, während Verkaufspreise und Börsen in einer roten Verkaufszeile angezeigt werden. Wenn der Spread null ist, sind die Preise an beiden Börsen gleich und es besteht keine Arbitragemöglichkeit. Verwenden Sie für eine höhere Genauigkeit den kleinsten in Ihrem TradingView-Abonnement verfügbaren Zeitrahmen, z. B. Minuten- oder Sekundenintervalle.

Für jedes Handelspaar zeigt die Tabelle unter der Zeile „Kaufen“ die Anzahl der Arbitragesituationen innerhalb eines bestimmten Zeitrahmens an. Eine Arbitragesituation tritt auf, wenn der Spread den vom Benutzer festgelegten Signalschwellenwert überschreitet. Jedes Mal, wenn dies geschieht, erhöht sich der Zähler um eins. Es werden nur Situationen gezählt, die innerhalb des ausgewählten Zeitrahmens aufgetreten sind, z. B. die letzte Stunde für einen Zeitraum von 1 Stunde. Sie können Arbitragesituationen für bis zu drei verschiedene Zeiträume gleichzeitig verfolgen, die von 5 Minuten bis 24 Stunden reichen. Dieser Zähler hilft bei der Bewertung des Arbitragepotenzials in den ausgewählten Handelspaaren. Wenn ein Paar nur 1-2 Arbitragesituationen pro Stunde zeigt, ist es möglicherweise besser, nach einem anderen Paar zu suchen.

In den Skripteinstellungen können Sie den Signalschwellenwert des Spreads festlegen. Wenn der Spread dieses Niveau erreicht, wird die Tabelle für diesen Vermögenswert hervorgehoben. Dieser Schwellenwert dient auch als Signal zum Einrichten von Alarmen. Um Alarme einzurichten, gehen Sie zur Registerkarte „Alarme“ im TradingView-Menü rechts, klicken Sie auf „Alarm erstellen“ und wählen Sie diesen Indikator unter „Bedingung“ aus. Sie können den Alarm dann benennen und die Einrichtung abschließen, indem Sie auf „Erstellen“ klicken.

Wir, die Autoren, sind seit langem in Kryptowährungsarbitrage involviert und haben dieses Skript für unseren eigenen Handel erstellt, aber Sie können es nach Belieben für beliebige Vermögenswerte und Märkte verwenden.

Wir bieten auch leichtere Versionen des Indikators an, die den Spread für ein oder drei Handelspaare verfolgen. Diese Versionen zeigen auch das Spread-Diagramm an, das für historische Analysen nützlich sein kann. Wenn der vollständige Indikator zu ressourcenintensiv für Ihr Gerät ist, versuchen Sie diese leichteren Versionen:


Arbitrage Spread v1: 1 Paar + 1 Diagramm
Arbitrage Spread v2: 3 Paare + 3 Diagramme

Wenn Ihre Hardware damit zurechtkommt, können Sie die 12-Paar-Version als Dashboard verwenden und eine der Versionen mit einem Spread-Diagramm für eine detaillierte Ansicht von einem oder drei Paaren hinzufügen.

TradingView Script Pine Script

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ArbyTradeManager
//@version=5

indicator(title="Arbitrage Spread v3 : 12 spreads dashboard [Arby.Trade]", shorttitle="Arbitrage Spread v3 : 12 spreads dashboard [Arby.Trade]", overlay=false,
 max_lines_count=500, max_labels_count=500, max_boxes_count=500, max_polylines_count=100,
 explicit_plot_zorder=true)


signal = "SIGNAL SETTINGS ___________________________________________________________________"
table_spread_porog = input.float(defval = 0.50, 
 title = "Spread Signal Threshold, %", tooltip = "If the spread value exceeds the level set here, the table with data on this asset will be highlighted. This threshold level also affects the alerts from TradingView, if you configure them in the TradingView alerts settings.\n\nЕсли значение спреда превысило установленный здесь уровень, то таблица по этому активу будет подсвечена. Этот пороговый уровень также влияет на оповещения от TradingView, если вы их настроите в настройках оповещений TradingView.", 
 step=0.01, group = signal)
alert_cond_inp = input.string("Once per bar", title = "Frequency of alerts", options = ["Once per bar", "All requests"], group = signal)


gr_pairs = "Pairs ___________________________________________________________________"

show_pair_1 = input.bool(true, title="1:", inline = "1", group = gr_pairs)
symbol1 = input.symbol(defval="BINANCE:PEPEUSDT", title="", inline = "1", group = gr_pairs)
symbol2 = input.symbol(defval ="MEXC:PEPEUSDT", title="", inline = "1", group = gr_pairs) 

//gr_pairs_2 = "2 PAIR ___________________________________________________"
show_pair_2 = input.bool(true, title = "2:", inline = "2", group = gr_pairs) 
symbol2_1 = input.symbol(defval="GATEIO:TENETUSDT", title="", inline = "2", group = gr_pairs) 
symbol2_2 = input.symbol(defval ="BYBIT:TENETUSDT", title="", inline = "2", group = gr_pairs) 

//gr_pairs_3 = "3 PAIR ___________________________________________________"
show_pair_3 = input.bool(true, title = "3:", inline = "3", group = gr_pairs) 
symbol3_1 = input.symbol(defval="OKX:TURBOUSDT" , title="", inline = "3", group = gr_pairs) 
symbol3_2 = input.symbol(defval ="MEXC:TURBOUSDT", title="", inline = "3", group = gr_pairs)

//gr_pairs_4 = "4 PAIR ___________________________________________________"
show_pair_4 = input.bool(true, title = "4:", inline = "4", group = gr_pairs) 
symbol4_1 = input.symbol(defval="BINANCE:BTCUSDT" , title="", inline = "4", group = gr_pairs) 
symbol4_2 = input.symbol(defval ="BYBIT:BTCUSDT", title="", inline = "4", group = gr_pairs)

//gr_pairs_5 = "5 PAIR ___________________________________________________"
show_pair_5 = input.bool(true, title = "5:", inline = "5", group = gr_pairs) 
symbol5_1 = input.symbol(defval="KUCOIN:ETHUSDT" , title="", inline = "5", group = gr_pairs) 
symbol5_2 = input.symbol(defval ="BYBIT:ETHUSDT", title="", inline = "5", group = gr_pairs)

//gr_pairs_6 = "6 PAIR ___________________________________________________"
show_pair_6 = input.bool(true, title = "6:", inline = "6", group = gr_pairs) 
symbol6_1 = input.symbol(defval="KUCOIN:POLSUSDT" , title="", inline = "6", group = gr_pairs) 
symbol6_2 = input.symbol(defval ="GATEIO:POLSUSDT", title="", inline = "6", group = gr_pairs)

//gr_pairs_7 = "7 PAIR ___________________________________________________"
show_pair_7 = input.bool(true, title = "7:", inline = "7", group = gr_pairs) 
symbol7_1 = input.symbol(defval="KUCOIN:XRPUSDT" , title="", inline = "7", group = gr_pairs) 
symbol7_2 = input.symbol(defval ="MEXC:XRPUSDT", title="", inline = "7", group = gr_pairs)

//gr_pairs_8 = "8 PAIR ___________________________________________________"
show_pair_8 = input.bool(true, title = "8:", inline = "8", group = gr_pairs) 
symbol8_1 = input.symbol(defval="BINANCE:SOLUSDT" , title="", inline = "8", group = gr_pairs) 
symbol8_2 = input.symbol(defval ="MEXC:SOLUSDT", title="", inline = "8", group = gr_pairs)

//gr_pairs_9 = "9 PAIR ___________________________________________________"
show_pair_9 = input.bool(true, title = "9:", inline = "9", group = gr_pairs) 
symbol9_1 = input.symbol(defval="MEXC:DGIUSDT" , title="", inline = "9", group = gr_pairs) 
symbol9_2 = input.symbol(defval ="BITGET:DGIUSDT", title="", inline = "9", group = gr_pairs)

//gr_pairs_10 = "10 PAIR ___________________________________________________"
show_pair_10 = input.bool(true, title = "10:", inline = "10", group = gr_pairs) 
symbol10_1 = input.symbol(defval="MEXC:NUMUSDT" , title="", inline = "10", group = gr_pairs) 
symbol10_2 = input.symbol(defval ="KUCOIN:NUMUSDT", title="", inline = "10", group = gr_pairs)

//gr_pairs_11 = "11 PAIR ___________________________________________________"
show_pair_11 = input.bool(true, title = "11:", inline = "11", group = gr_pairs) 
symbol11_1 = input.symbol(defval="BYBIT:ADAUSDT" , title="", inline = "11", group = gr_pairs) 
symbol11_2 = input.symbol(defval ="OKX:ADAUSDT", title="", inline = "11", group = gr_pairs)

//gr_pairs_12 = "12 PAIR ___________________________________________________"
show_pair_12 = input.bool(true, title = "12:", inline = "12", group = gr_pairs) 
symbol12_1 = input.symbol(defval="BINANCE:COTIUSDT" , title="", inline = "12", group = gr_pairs) 
symbol12_2 = input.symbol(defval ="KUCOIN:COTIUSDT", title="", inline = "12", group = gr_pairs)

gr_count = "SPREAD COUNTER ___________________________________________________________________"
show_counts = input.bool(true, title = "Show the counter row", 
 tooltip = "Here you can set up a counter for the number of times a spread occurs that exceeds the Signal Threshold Level (the number of arbitrage situations). The counter calculates the number of arbitration situations for three selected time periods. Below, you can configure during which periods the counter calculates arbitration situations, or disable these lines altogether, thereby reducing the load. The calculation results are shown in the table below the current asset prices.\n\nЗдесь вы можете настроить счетчик количества раз возникновения спреда, превышающего уровень Signal Threshold Level (количество арбитражных ситуаций). Счетчик вычисляет количество арбитражных ситуаций за три выбранных временных периода. Ниже можно настроить в течение каких периодов счетчику вычислять арбитражные ситуации, или отключить эти строки вовсе, тем самым снизив нагрузку. Результаты вычислений указываются в таблице под текущими ценами актива.", 
 group = gr_count)
show_count_1 = input.bool(true, title = "1 Period", inline = "count1", group = gr_count)
count_1_period = input.string(defval = "5 min", title = "", options = ["5 min", "1 hour", "4 hours", "6 hours", "12 hours", "Day"], inline = "count1", group = gr_count)
show_count_2 = input.bool(true, title = "2 Period", inline = "count2", group = gr_count)
count_2_period = input.string(defval = "1 hour", title = "", options = ["5 min", "1 hour", "4 hours", "6 hours", "12 hours", "Day"], inline = "count2", group = gr_count)
show_count_3 = input.bool(true, title = "3 Period", inline = "count3", group = gr_count)
count_3_period = input.string(defval = "12 hours", title = "", options = ["5 min", "1 hour", "4 hours", "6 hours", "12 hours", "Day"], inline = "count3", group = gr_count)


gr_tables = "TABLES SETTINGS ___________________________________________________________________"
txt_size = input.string("Small", title = "Size table : ", options = ["Small", "Normal"], inline="size", group = gr_tables)
top_indentation = input.int(7, title = "Indentation. Top:", inline = "indentation", group = gr_tables)
//bottom_indentation = input.int(1, title = "Bottom. Top:", inline = "indentation", group = gr_tables)
bottom_indentation = 0
right_indentation = input.int(0, title = "Left:", inline = "indentation", group = gr_tables)
width_frame_inp = input.int(2, title = "Distance. Width:", inline = "distance", group = gr_tables) //between tables
height_frame = input.int(4, title = "Hght:", inline = "distance", group = gr_tables)
table_width_1 = input.int(7, title = "Column wdt", minval=0, inline="column", group = gr_tables)
table_width_2 = input.int(7, title = "", inline="column", minval=0, group = gr_tables)
table_width_price = input.int(9, title = "", minval=0, inline="column", group = gr_tables)
table_height = input.int(7, title = "Rows height", minval=0, group = gr_tables)


gr_colors = "COLORS SETTINGS ___________________________________________________________________"
white_theme = input.bool(false, title = "Light Mode set, backgr.:", inline = "white_theme", group = gr_colors)
color_bg_w = input.color(defval = color.new(#e2ecec, 0), title = "", inline = "white_theme", group = gr_colors)
color_txt_w = input.color(defval = color.new(#2d3137, 0), title = "Txt:", inline = "white_theme", group = gr_colors
 , tooltip = "If a light mode is selected in your global TradingView settings instead of a dark mode, then click this checkbox.\n\nЕсли в ваших глобальных настройках TradingView выбран светлый режим вместо темного, включите эту настройку.")

less_color = input.bool(false, title = "Less color background :", inline = "less col", group = gr_colors)
less_color_bg = input.color(color.new(#0e1620, 0), title = "",  inline = "less col", group = gr_colors)

color_pair_bg = input.color(color.new(#131e2c, 0), title = "Table standart colors, backgr.:",  inline = "3", group = gr_colors)
color_pair_txt = input.color(color.new(#ababab, 0), title = "Txt:",  inline = "3", group = gr_colors)

color_treshold_bg = input.color(color.new(#fff36b, 0), title = "Table threshold colors, backgr", inline = "Treshold", group = gr_colors)
color_treshold_txt = input.color(color.black, title = "Txt:", inline = "Treshold", group = gr_colors)

table_buy_bg = input.color(color.new(#009075, 0), title = "Table buy colors,  background :", inline = "buy col", group = gr_colors)
table_buy_txt = input.color(color.new(color.white, 0), title = "Txt:", inline = "buy col", group = gr_colors)

table_sell_bg = input.color(color.new(#aa2c52, 0), title = "Table sell colors,  background :", inline = "sell col", group = gr_colors)
table_sell_txt = input.color(color.new(color.white, 0), title = "Txt:", inline = "sell col", group = gr_colors)

color_frame_inp = color.rgb(95, 95, 95)
color_frame_trsp = 100
color_frame = color.new(color_frame_inp, color_frame_trsp)
text_color_frame = color.new(color.white, 100)

gr_about = "About ____________________________________________________________"
about_ind = input.bool(false, title = "About indicator & us", tooltip = "To find out more, click on this check-box. \n\nЧтобы узнать больше нажмите на этот чек-бокс."
 , group = gr_about) 


//----------------------------------------------------------
// DATA COLLECTION AND CALCULATIONS
//----------------------------------------------------------

f_request(f_show_pair, f_symbol1, f_symbol2) =>
    f_para1_ = f_show_pair ? request.security(f_symbol1, timeframe.period, close) : na
    f_para2_ = f_show_pair ? request.security(f_symbol2, timeframe.period, close) : na
    [f_para1_, f_para2_]
    
[para1, para2]          = f_request(show_pair_1, symbol1, symbol2)
[para2_1, para2_2]      = f_request(show_pair_2, symbol2_1, symbol2_2)
[para3_1, para3_2]      = f_request(show_pair_3, symbol3_1, symbol3_2)
[para4_1, para4_2]      = f_request(show_pair_4, symbol4_1, symbol4_2)
[para5_1, para5_2]      = f_request(show_pair_5, symbol5_1, symbol5_2)
[para6_1, para6_2]      = f_request(show_pair_6, symbol6_1, symbol6_2)
[para7_1, para7_2]      = f_request(show_pair_7, symbol7_1, symbol7_2)
[para8_1, para8_2]      = f_request(show_pair_8, symbol8_1, symbol8_2)
[para9_1, para9_2]      = f_request(show_pair_9, symbol9_1, symbol9_2)
[para10_1, para10_2]    = f_request(show_pair_10, symbol10_1, symbol10_2)
[para11_1, para11_2]    = f_request(show_pair_11, symbol11_1, symbol11_2)
[para12_1, para12_2]    = f_request(show_pair_12, symbol12_1, symbol12_2)


f_spread(f_para1, f_para2) =>
    f_spread_ = 100*(f_para1 - f_para2)/f_para1

spread_1 =  show_pair_1     ? f_spread(para1, para2) : na
spread_2 =  show_pair_2     ? f_spread(para2_1, para2_2) : na
spread_3 =  show_pair_3     ? f_spread(para3_1, para3_2) : na
spread_4 =  show_pair_4     ? f_spread(para4_1, para4_2) : na
spread_5 =  show_pair_5     ? f_spread(para5_1, para5_2) : na
spread_6 =  show_pair_6     ? f_spread(para6_1, para6_2) : na
spread_7 =  show_pair_7     ? f_spread(para7_1, para7_2) : na
spread_8 =  show_pair_8     ? f_spread(para8_1, para8_2) : na
spread_9 =  show_pair_9     ? f_spread(para9_1, para9_2) : na 
spread_10 = show_pair_10    ? f_spread(para10_1, para10_2) : na
spread_11 = show_pair_11    ? f_spread(para11_1, para11_2) : na
spread_12 = show_pair_12    ? f_spread(para12_1, para12_2) : na

//----------------------------------------------------------
// COUNT CALCULATE
//----------------------------------------------------------

//    count function
f_counter(f_spread, f_period, f_threshold) =>
    var int[] f_array_counts = array.new_int()
    var int f_count = na
    if array.size(f_array_counts) > 0 
        if array.first(f_array_counts) + f_period < time
            array.shift(f_array_counts)
    if array.size(f_array_counts) == 0 and (f_spread > f_threshold or f_spread < -f_threshold)
        f_count := time
        array.push(f_array_counts, f_count)
    if ta.crossover(f_spread, f_threshold) or ta.crossunder(f_spread, - f_threshold)
        f_count := time
        array.push(f_array_counts, f_count)
    f_count_size = array.size(f_array_counts)
    f_count_size

//    periods function
f_period(f_period_sec) =>
    f_period_sec=="5 min" ? 300000 : f_period_sec=="1 hour" ? 3600000 : f_period_sec=="4 hours" ? 14400000 
     : f_period_sec=="6 hours" ? 21600000  : f_period_sec=="12 hours" ? 43200000  : f_period_sec=="Day" ? 86400000  : na
period1 = f_period(count_1_period)
period2 = f_period(count_2_period)
period3 = f_period(count_3_period)

//    counting
var int count1_1_size = na
var int count1_2_size = na
var int count1_3_size = na
var int count2_1_size = na
var int count2_2_size = na
var int count2_3_size = na
var int count3_1_size = na
var int count3_2_size = na
var int count3_3_size = na
var int count4_1_size = na
var int count4_2_size = na
var int count4_3_size = na
var int count5_1_size = na
var int count5_2_size = na
var int count5_3_size = na
var int count6_1_size = na
var int count6_2_size = na
var int count6_3_size = na
var int count7_1_size = na
var int count7_2_size = na
var int count7_3_size = na
var int count8_1_size = na
var int count8_2_size = na
var int count8_3_size = na
var int count9_1_size = na
var int count9_2_size = na
var int count9_3_size = na
var int count10_1_size = na
var int count10_2_size = na
var int count10_3_size = na
var int count11_1_size = na
var int count11_2_size = na
var int count11_3_size = na
var int count12_1_size = na
var int count12_2_size = na
var int count12_3_size = na

if show_counts
    if show_count_1 
        count1_1_size :=  show_pair_1  ? f_counter(spread_1, period1, table_spread_porog) : na
        count2_1_size :=  show_pair_2  ? f_counter(spread_2, period1, table_spread_porog) : na
        count3_1_size :=  show_pair_3  ? f_counter(spread_3, period1, table_spread_porog) : na
        count4_1_size :=  show_pair_4  ? f_counter(spread_4, period1, table_spread_porog) : na
        count5_1_size :=  show_pair_5  ? f_counter(spread_5, period1, table_spread_porog) : na
        count6_1_size :=  show_pair_6  ? f_counter(spread_6, period1, table_spread_porog) : na
        count7_1_size :=  show_pair_7  ? f_counter(spread_7, period1, table_spread_porog) : na
        count8_1_size :=  show_pair_8  ? f_counter(spread_8, period1, table_spread_porog) : na
        count9_1_size :=  show_pair_9  ? f_counter(spread_9, period1, table_spread_porog) : na
        count10_1_size := show_pair_10 ? f_counter(spread_10, period1, table_spread_porog) : na
        count11_1_size := show_pair_11 ? f_counter(spread_11, period1, table_spread_porog) : na
        count12_1_size := show_pair_12 ? f_counter(spread_12, period1, table_spread_porog) : na
    if show_count_2
        count1_2_size :=  show_pair_1 ?  f_counter(spread_1, period2, table_spread_porog) : na
        count2_2_size :=  show_pair_2 ?  f_counter(spread_2, period2, table_spread_porog) : na
        count3_2_size :=  show_pair_3 ?  f_counter(spread_3, period2, table_spread_porog) : na
        count4_2_size :=  show_pair_4 ?  f_counter(spread_4, period2, table_spread_porog) : na
        count5_2_size :=  show_pair_5 ?  f_counter(spread_5, period2, table_spread_porog) : na
        count6_2_size :=  show_pair_6 ?  f_counter(spread_6, period2, table_spread_porog) : na
        count7_2_size :=  show_pair_7 ?  f_counter(spread_7, period2, table_spread_porog) : na
        count8_2_size :=  show_pair_8 ?  f_counter(spread_8, period2, table_spread_porog) : na
        count9_2_size :=  show_pair_9 ?  f_counter(spread_9, period2, table_spread_porog) : na
        count10_2_size := show_pair_10 ? f_counter(spread_10, period2, table_spread_porog) : na
        count11_2_size := show_pair_11 ? f_counter(spread_11, period2, table_spread_porog) : na
        count12_2_size := show_pair_12 ? f_counter(spread_12, period2, table_spread_porog) : na
    if show_count_3
        count1_3_size :=  show_pair_1  ? f_counter(spread_1, period3, table_spread_porog) : na
        count2_3_size :=  show_pair_2  ? f_counter(spread_2, period3, table_spread_porog) : na
        count3_3_size :=  show_pair_3  ? f_counter(spread_3, period3, table_spread_porog) : na
        count4_3_size :=  show_pair_4  ? f_counter(spread_4, period3, table_spread_porog) : na
        count5_3_size :=  show_pair_5  ? f_counter(spread_5, period3, table_spread_porog) : na
        count6_3_size :=  show_pair_6  ? f_counter(spread_6, period3, table_spread_porog) : na
        count7_3_size :=  show_pair_7  ? f_counter(spread_7, period3, table_spread_porog) : na
        count8_3_size :=  show_pair_8  ? f_counter(spread_8, period3, table_spread_porog) : na
        count9_3_size :=  show_pair_9  ? f_counter(spread_9, period3, table_spread_porog) : na
        count10_3_size := show_pair_10 ? f_counter(spread_10, period3, table_spread_porog) : na
        count11_3_size := show_pair_11 ? f_counter(spread_11, period3, table_spread_porog) : na
        count12_3_size := show_pair_12 ? f_counter(spread_12, period3, table_spread_porog) : na

//----------------------------------------------------------
// ALERTS
//----------------------------------------------------------

//    text for alert
f_alert(f_spread_alert, f_symbol1_, f_symbol2_) =>
    f_alert = str.tostring(syminfo.ticker(f_symbol1_)) + " - " + str.tostring(syminfo.prefix(f_symbol1_)) + " / " + str.tostring(syminfo.prefix(f_symbol2_)) + " - " + str.tostring(math.round(f_spread_alert, 2)) + " %"

f_alert_cond(f_spread_cond) => ta.crossover(math.abs(f_spread_cond), table_spread_porog)

alert_freq = alert_cond_inp=="Once per bar" ? alert.freq_once_per_bar : alert.freq_all

//    f alerts with condition
f_alert_push(f_spread_push, f_symbol1_p, f_symbol2_p) =>
    if ta.crossover(math.abs(f_spread_push), table_spread_porog)
        alert(message=f_alert(f_spread_push, f_symbol1_p, f_symbol2_p), freq=alert_freq)

f_alert_push(spread_1,  symbol1,    symbol2)
f_alert_push(spread_2,  symbol2_1,  symbol2_2)
f_alert_push(spread_3,  symbol3_1,  symbol3_2)
f_alert_push(spread_4,  symbol4_1,  symbol4_2)
f_alert_push(spread_5,  symbol5_1,  symbol5_2)
f_alert_push(spread_6,  symbol6_1,  symbol6_2)
f_alert_push(spread_7,  symbol7_1,  symbol7_2)
f_alert_push(spread_8,  symbol8_1,  symbol8_2)
f_alert_push(spread_9,  symbol9_1,  symbol9_2)
f_alert_push(spread_10, symbol10_1, symbol10_2)
f_alert_push(spread_11, symbol11_1, symbol11_2)
f_alert_push(spread_12, symbol12_1, symbol12_2)
 

//----------------------------------------------------------
// GENERAL TABLES SETTINGS
//----------------------------------------------------------

//table_bg = color.new(#0a1828, 0)
if about_ind==true
    right_indentation := 0

threshold_bg = color.new(#fff382, 0)  // yellow for spread

// color spread
color_txt_s_w = color.new(#908100, 0)

// color buy / sell
table_sell_color = table_sell_bg
table_buy_color = table_buy_bg
table_text_color_buy = table_buy_txt
table_text_color_sell = table_sell_txt
//buy_sell_bg_w = color.rgb(252, 252, 252)
buy_sell_bg_w = color.rgb(249, 249, 249)
if less_color
    table_buy_color := less_color_bg
    table_text_color_buy := table_buy_bg
    table_sell_color := less_color_bg
    table_text_color_sell := table_sell_bg
    if white_theme
        table_buy_color := buy_sell_bg_w
        table_text_color_buy := table_buy_bg
        table_sell_color := buy_sell_bg_w
        table_text_color_sell := table_sell_bg

// color count
color_txt_count_1 = color.new(color_pair_txt, 50)
color_txt_count_2 = color.new(color_pair_txt, 10)
color_txt_count_1_w = color.new(color_txt_w, 50)
color_txt_count_2_w = color.new(color_txt_w, 10)

// color count
tbl_count_txt1_1 = count1_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt1_2 = count1_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt1_3 = count1_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt2_1 = count2_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt2_2 = count2_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt2_3 = count2_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt3_1 = count3_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt3_2 = count3_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt3_3 = count3_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt4_1 = count4_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt4_2 = count4_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt4_3 = count4_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt5_1 = count5_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt5_2 = count5_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt5_3 = count5_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt6_1 = count6_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt6_2 = count6_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt6_3 = count6_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt7_1 = count7_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt7_2 = count7_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt7_3 = count7_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt8_1 = count8_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt8_2 = count8_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt8_3 = count8_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt9_1 = count9_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt9_2 = count9_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt9_3 = count9_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt10_1 = count10_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt10_2 = count10_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt10_3 = count10_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt11_1 = count11_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt11_2 = count11_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt11_3 = count11_3_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt12_1 = count12_1_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt12_2 = count12_2_size > 0 ? color_txt_count_2 : color_txt_count_1
tbl_count_txt12_3 = count12_3_size > 0 ? color_txt_count_2 : color_txt_count_1

if show_count_1==false or show_counts==false
    tbl_count_txt1_1 := color.new(color.white, 100)
    tbl_count_txt2_1 := color.new(color.white, 100)
    tbl_count_txt3_1 := color.new(color.white, 100)
    tbl_count_txt4_1 := color.new(color.white, 100)
    tbl_count_txt5_1 := color.new(color.white, 100)
    tbl_count_txt6_1 := color.new(color.white, 100)
    tbl_count_txt7_1 := color.new(color.white, 100)
    tbl_count_txt8_1 := color.new(color.white, 100)
    tbl_count_txt9_1 := color.new(color.white, 100)
    tbl_count_txt10_1 := color.new(color.white, 100)
    tbl_count_txt11_1 := color.new(color.white, 100)
    tbl_count_txt12_1 := color.new(color.white, 100)
if show_count_2==false or show_counts==false
    tbl_count_txt1_2 := color.new(color.white, 100)
    tbl_count_txt2_2 := color.new(color.white, 100)
    tbl_count_txt3_2 := color.new(color.white, 100)
    tbl_count_txt4_2 := color.new(color.white, 100)
    tbl_count_txt5_2 := color.new(color.white, 100)
    tbl_count_txt6_2 := color.new(color.white, 100)
    tbl_count_txt7_2 := color.new(color.white, 100)
    tbl_count_txt8_2 := color.new(color.white, 100)
    tbl_count_txt9_2 := color.new(color.white, 100)
    tbl_count_txt10_2 := color.new(color.white, 100)
    tbl_count_txt11_2 := color.new(color.white, 100)
    tbl_count_txt12_2 := color.new(color.white, 100)
if show_count_3==false or show_counts==false
    tbl_count_txt1_3 := color.new(color.white, 100)
    tbl_count_txt2_3 := color.new(color.white, 100)
    tbl_count_txt3_3 := color.new(color.white, 100)
    tbl_count_txt4_3 := color.new(color.white, 100)
    tbl_count_txt5_3 := color.new(color.white, 100)
    tbl_count_txt6_3 := color.new(color.white, 100)
    tbl_count_txt7_3 := color.new(color.white, 100)
    tbl_count_txt8_3 := color.new(color.white, 100)
    tbl_count_txt9_3 := color.new(color.white, 100)
    tbl_count_txt10_3 := color.new(color.white, 100)
    tbl_count_txt11_3 := color.new(color.white, 100)
    tbl_count_txt12_3 := color.new(color.white, 100)

if white_theme
    tbl_count_txt1_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count1_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt1_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count1_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt1_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count1_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt2_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count2_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt2_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count2_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt2_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count2_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt3_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count3_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt3_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count3_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt3_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count3_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt4_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count4_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt4_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count4_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt4_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count4_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt5_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count5_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt5_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count5_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt5_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count5_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt6_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count6_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt6_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count6_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt6_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count6_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt7_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count7_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt7_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count7_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt7_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count7_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt8_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count8_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt8_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count8_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt8_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count8_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt9_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count9_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt9_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count9_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt9_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count9_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt10_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count10_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt10_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count10_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt10_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count10_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt11_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count11_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt11_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count11_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt11_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count11_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt12_1 := show_count_1==false or show_counts==false ? color.new(color.white, 100) : count12_1_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt12_2 := show_count_2==false or show_counts==false ? color.new(color.white, 100) : count12_2_size == 0 ? color_txt_count_1_w : color_txt_count_2_w
    tbl_count_txt12_3 := show_count_3==false or show_counts==false ? color.new(color.white, 100) : count12_3_size == 0 ? color_txt_count_1_w : color_txt_count_2_w


// text for count
f_period_txt(f_period_txt) =>
    f_period_txt=="5 min" ? "5m: " : f_period_txt=="1 hour" ? "1h: " : f_period_txt=="4 hours" ? "4h: " 
     : f_period_txt=="6 hours" ? "6h: "  : f_period_txt=="12 hours" ? "12h: "  : f_period_txt=="Day" ? "D: "  : na
period_1_ = f_period_txt(count_1_period)
period_2_ = f_period_txt(count_2_period)
period_3_ = f_period_txt(count_3_period)

// function for text to buy+sell rows
f_spread_txt(f_spread__, f_para_2, f_symbol_2, f_para_1, f_symbol_1) =>
    var series string f_table_buy_para = na
    var series string f_table_buy_exch = na
    var series string f_table_sell_para = na
    var series string f_table_sell_exch = na
    var series string f_spread_txt = na
    if f_spread__ > 0
        f_table_buy_para := str.tostring(f_para_2)
        f_table_buy_exch := str.tostring(syminfo.prefix(f_symbol_2))
        f_table_sell_para := str.tostring(f_para_1)
        f_table_sell_exch := str.tostring(syminfo.prefix(f_symbol_1))
        f_spread_txt := "+" + str.tostring(math.round(f_spread__, 2)) + " %"
    if f_spread__ < 0
        f_table_buy_para := str.tostring(f_para_1)
        f_table_buy_exch := str.tostring(syminfo.prefix(f_symbol_1))
        f_table_sell_para := str.tostring(f_para_2)
        f_table_sell_exch := str.tostring(syminfo.prefix(f_symbol_2))
        f_spread_txt := str.tostring(math.round(f_spread__, 2)) + " %"
    [f_table_buy_para, f_table_buy_exch, f_table_sell_para, f_table_sell_exch, f_spread_txt]

//  text for buy+sell rows
[table_buy_para, table_buy_exch, table_sell_para, table_sell_exch, spread_txt] = f_spread_txt(spread_1, para2, symbol2, para1, symbol1)
[table_buy_para_2, table_buy_exch_2, table_sell_para_2, table_sell_exch_2, spread_txt_2] = f_spread_txt(spread_2, para2_2, symbol2_2, para2_1, symbol2_1)
[table_buy_para_3, table_buy_exch_3, table_sell_para_3, table_sell_exch_3, spread_txt_3] = f_spread_txt(spread_3, para3_2, symbol3_2, para3_1, symbol3_1)
[table_buy_para_4, table_buy_exch_4, table_sell_para_4, table_sell_exch_4, spread_txt_4] = f_spread_txt(spread_4, para4_2, symbol4_2, para4_1, symbol4_1)
[table_buy_para_5, table_buy_exch_5, table_sell_para_5, table_sell_exch_5, spread_txt_5] = f_spread_txt(spread_5, para5_2, symbol5_2, para5_1, symbol5_1)
[table_buy_para_6, table_buy_exch_6, table_sell_para_6, table_sell_exch_6, spread_txt_6] = f_spread_txt(spread_6, para6_2, symbol6_2, para6_1, symbol6_1)
[table_buy_para_7, table_buy_exch_7, table_sell_para_7, table_sell_exch_7, spread_txt_7] = f_spread_txt(spread_7, para7_2, symbol7_2, para7_1, symbol7_1)
[table_buy_para_8, table_buy_exch_8, table_sell_para_8, table_sell_exch_8, spread_txt_8] = f_spread_txt(spread_8, para8_2, symbol8_2, para8_1, symbol8_1)
[table_buy_para_9, table_buy_exch_9, table_sell_para_9, table_sell_exch_9, spread_txt_9] = f_spread_txt(spread_9, para9_2, symbol9_2, para9_1, symbol9_1)
[table_buy_para_10, table_buy_exch_10, table_sell_para_10, table_sell_exch_10, spread_txt_10] = f_spread_txt(spread_10, para10_2, symbol10_2, para10_1, symbol10_1)
[table_buy_para_11, table_buy_exch_11, table_sell_para_11, table_sell_exch_11, spread_txt_11] = f_spread_txt(spread_11, para11_2, symbol11_2, para11_1, symbol11_1)
[table_buy_para_12, table_buy_exch_12, table_sell_para_12, table_sell_exch_12, spread_txt_12] = f_spread_txt(spread_12, para12_2, symbol12_2, para12_1, symbol12_1)

// function for color spread
f_color_spread(f_spread_col) =>
    f_tbl_spread_bg_2 = white_theme ? color_bg_w : color_pair_bg
    f_tbl_spread_txt_2 = white_theme ? color_txt_s_w : threshold_bg
    f_tbl_spread_txt2_2 = white_theme ? color_txt_w : color_pair_txt
    if math.abs(f_spread_col) >= table_spread_porog
        f_tbl_spread_bg_2 := color_treshold_bg
        f_tbl_spread_txt_2 := color_treshold_txt
        f_tbl_spread_txt2_2 := color_treshold_txt
    [f_tbl_spread_bg_2, f_tbl_spread_txt_2, f_tbl_spread_txt2_2]

// color spread
[tbl_spread_bg_1, tbl_spread_txt_1, tbl_spread_txt2_1] = f_color_spread(spread_1)
[tbl_spread_bg_2, tbl_spread_txt_2, tbl_spread_txt2_2] = f_color_spread(spread_2)
[tbl_spread_bg_3, tbl_spread_txt_3, tbl_spread_txt2_3] = f_color_spread(spread_3)
[tbl_spread_bg_4, tbl_spread_txt_4, tbl_spread_txt2_4] = f_color_spread(spread_4)
[tbl_spread_bg_5, tbl_spread_txt_5, tbl_spread_txt2_5] = f_color_spread(spread_5)
[tbl_spread_bg_6, tbl_spread_txt_6, tbl_spread_txt2_6] = f_color_spread(spread_6)
[tbl_spread_bg_7, tbl_spread_txt_7, tbl_spread_txt2_7] = f_color_spread(spread_7)
[tbl_spread_bg_8, tbl_spread_txt_8, tbl_spread_txt2_8] = f_color_spread(spread_8)
[tbl_spread_bg_9, tbl_spread_txt_9, tbl_spread_txt2_9] = f_color_spread(spread_9)
[tbl_spread_bg_10, tbl_spread_txt_10, tbl_spread_txt2_10] = f_color_spread(spread_10)
[tbl_spread_bg_11, tbl_spread_txt_11, tbl_spread_txt2_11] = f_color_spread(spread_11)
[tbl_spread_bg_12, tbl_spread_txt_12, tbl_spread_txt2_12] = f_color_spread(spread_12)


//----------------------------------------------------------
// TABLE 1
//----------------------------------------------------------

// text for count
period1_1_txt = period_1_ + str.tostring(count1_1_size)
period1_2_txt = period_2_ + str.tostring(count1_2_size)
period1_3_txt = period_3_ + str.tostring(count1_3_size)

table_buy_bg_1 = table_buy_color
table_buy_txt_1 = table_text_color_buy
table_sell_bg_1 = table_sell_color
table_sell_txt_1 = table_text_color_sell

tbl_count_bg_1 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_1 = "1"
txt_ticker_1 = str.tostring(syminfo.ticker(symbol1))
txt_sell_1 = "SELL"
txt_buy_1 = "BUY"
if show_pair_1==false 
    tbl_spread_bg_1 := na
    tbl_spread_txt2_1 := na
    table_sell_bg_1 := na
    table_sell_txt_1 := na
    table_buy_bg_1 := na
    table_buy_txt_1 := na
    txt_num_1 := na
    spread_txt := na
    txt_ticker_1 := na
    txt_sell_1 := na
    table_sell_exch := na
    table_sell_para := na
    txt_buy_1 := na
    table_buy_exch := na
    table_buy_para := na
    tbl_count_bg_1 := na
    tbl_count_txt1_1 := na
    tbl_count_txt1_2 := na 
    tbl_count_txt1_3 := na 


//----------------------------------------------------------
// TABLE 2
//----------------------------------------------------------

// text for count
period2_1_txt = period_1_ + str.tostring(count2_1_size)
period2_2_txt = period_2_ + str.tostring(count2_2_size)
period2_3_txt = period_3_ + str.tostring(count2_3_size)
    
table_sell_bg_2 = table_sell_color
table_sell_txt_2 = table_text_color_sell
table_buy_bg_2 = table_buy_color
table_buy_txt_2 = table_text_color_buy

tbl_count_bg_2 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_2 = "2"
txt_ticker_2 = str.tostring(syminfo.ticker(symbol2_1))
txt_sell_2 = "SELL"
txt_buy_2 = "BUY"

if show_pair_2==false
    tbl_spread_bg_2 := na
    tbl_spread_txt2_2 := na
    table_sell_bg_2 := na
    table_sell_txt_2 := na
    table_buy_bg_2 := na
    table_buy_txt_2 := na
    txt_num_2 := na
    spread_txt_2 := na
    txt_ticker_2 := na
    txt_sell_2 := na
    table_sell_exch_2 := na
    table_sell_para_2 := na
    txt_buy_2 := na
    table_buy_exch_2 := na
    table_buy_para_2 := na
    tbl_count_bg_2 := na
    tbl_count_txt2_1 := na
    tbl_count_txt2_2 := na 
    tbl_count_txt2_3 := na 

//----------------------------------------------------------
// TABLE 3
//----------------------------------------------------------

// text for count
period3_1_txt = period_1_ + str.tostring(count3_1_size)
period3_2_txt = period_2_ + str.tostring(count3_2_size)
period3_3_txt = period_3_ + str.tostring(count3_3_size)

table_sell_bg_3 = table_sell_color
table_sell_txt_3 = table_text_color_sell
table_buy_bg_3 = table_buy_color
table_buy_txt_3 = table_text_color_buy

tbl_count_bg_3 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_3 = "3"
txt_ticker_3 = str.tostring(syminfo.ticker(symbol3_1))
txt_sell_3 = "SELL"
txt_buy_3 = "BUY"
if show_pair_3==false or about_ind
    tbl_spread_bg_3 :=  na
    tbl_spread_txt2_3 := na
    table_sell_bg_3 := na
    table_sell_txt_3 := na
    table_buy_bg_3 := na
    table_buy_txt_3 := na
    txt_num_3 := na
    spread_txt_3 := na
    txt_ticker_3 := na
    txt_sell_3 := na
    table_sell_exch_3 := na
    table_sell_para_3 := na
    txt_buy_3 := na
    table_buy_exch_3 := na
    table_buy_para_3 := na
    tbl_count_bg_3 := na
    tbl_count_txt3_1 := na
    tbl_count_txt3_2 := na 
    tbl_count_txt3_3 := na 

//----------------------------------------------------------
// TABLE 4
//----------------------------------------------------------

// text for count
period4_1_txt = period_1_ + str.tostring(count4_1_size)
period4_2_txt = period_2_ + str.tostring(count4_2_size)
period4_3_txt = period_3_ + str.tostring(count4_3_size)
 
table_sell_bg_4 = table_sell_color
table_sell_txt_4 = table_text_color_sell
table_buy_bg_4 = table_buy_color
table_buy_txt_4 = table_text_color_buy

tbl_count_bg_4 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_4 = "4"
txt_ticker_4 = str.tostring(syminfo.ticker(symbol4_1))
txt_sell_4 = "SELL"
txt_buy_4 = "BUY"
if show_pair_4==false or about_ind 
    tbl_spread_bg_4 := na
    tbl_spread_txt2_4 := na
    table_sell_bg_4 := na
    table_sell_txt_4 := na
    table_buy_bg_4 := na
    table_buy_txt_4 := na
    txt_num_4 := na
    spread_txt_4 := na
    txt_ticker_4 := na
    txt_sell_4 := na
    table_sell_exch_4 := na
    table_sell_para_4 := na
    txt_buy_4 := na
    table_buy_exch_4 := na
    table_buy_para_4 := na
    tbl_count_bg_4 := na
    tbl_count_txt4_1 := na
    tbl_count_txt4_2 := na 
    tbl_count_txt4_3 := na 

//----------------------------------------------------------
// TABLE 5
//----------------------------------------------------------

// text for count
period5_1_txt = period_1_ + str.tostring(count5_1_size)
period5_2_txt = period_2_ + str.tostring(count5_2_size)
period5_3_txt = period_3_ + str.tostring(count5_3_size)

table_sell_bg_5 = table_sell_color
table_sell_txt_5 = table_text_color_sell
table_buy_bg_5 = table_buy_color
table_buy_txt_5 = table_text_color_buy

tbl_count_bg_5 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_5 = "5" 
txt_ticker_5 = str.tostring(syminfo.ticker(symbol5_1))
txt_sell_5 = "SELL"
txt_buy_5 = "BUY"
if show_pair_5==false
    tbl_spread_bg_5 := na
    tbl_spread_txt2_5 := na
    table_sell_bg_5 := na
    table_sell_txt_5 := na
    table_buy_bg_5 := na
    table_buy_txt_5 := na
    txt_num_5 := na
    spread_txt_5 := na
    txt_ticker_5 := na
    txt_sell_5 := na
    table_sell_exch_5 := na
    table_sell_para_5 := na
    txt_buy_5 := na
    table_buy_exch_5 := na
    table_buy_para_5 := na
    tbl_count_bg_5 := na
    tbl_count_txt5_1 := na
    tbl_count_txt5_2 := na 
    tbl_count_txt5_3 := na 

//----------------------------------------------------------
// TABLE 6
//----------------------------------------------------------

// text for count
period6_1_txt = period_1_ + str.tostring(count6_1_size)
period6_2_txt = period_2_ + str.tostring(count6_2_size)
period6_3_txt = period_3_ + str.tostring(count6_3_size)

table_sell_bg_6 = table_sell_color
table_sell_txt_6 = table_text_color_sell
table_buy_bg_6 = table_buy_color
table_buy_txt_6 = table_text_color_buy

tbl_count_bg_6 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_6 = "6"
txt_ticker_6 = str.tostring(syminfo.ticker(symbol6_1))
txt_sell_6 = "SELL"
txt_buy_6 = "BUY"
if show_pair_6==false
    tbl_spread_bg_6 := na
    tbl_spread_txt2_6 := na
    table_sell_bg_6 := na
    table_sell_txt_6 := na
    table_buy_bg_6 := na
    table_buy_txt_6 := na
    txt_num_6 := na
    spread_txt_6 := na
    txt_ticker_6 := na
    txt_sell_6 := na
    table_sell_exch_6 := na
    table_sell_para_6 := na
    txt_buy_6 := na
    table_buy_exch_6 := na
    table_buy_para_6 := na
    tbl_count_bg_6 := na
    tbl_count_txt6_1 := na
    tbl_count_txt6_2 := na 
    tbl_count_txt6_3 := na 

//----------------------------------------------------------
// TABLE 7
//----------------------------------------------------------

// text for count
period7_1_txt = period_1_ + str.tostring(count7_1_size)
period7_2_txt = period_2_ + str.tostring(count7_2_size)
period7_3_txt = period_3_ + str.tostring(count7_3_size)

table_sell_bg_7 = table_sell_color
table_sell_txt_7 = table_text_color_sell
table_buy_bg_7 = table_buy_color
table_buy_txt_7 = table_text_color_buy

tbl_count_bg_7 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_7 = "7"
txt_ticker_7 = str.tostring(syminfo.ticker(symbol7_1))
txt_sell_7 = "SELL"
txt_buy_7 = "BUY"
if show_pair_7==false or about_ind
    tbl_spread_bg_7 := na
    tbl_spread_txt2_7 := na
    table_sell_bg_7 := na
    table_sell_txt_7 := na
    table_buy_bg_7 := na
    table_buy_txt_7 := na
    txt_num_7 := na
    spread_txt_7 := na
    txt_ticker_7 := na
    txt_sell_7 := na
    table_sell_exch_7 := na
    table_sell_para_7 := na
    txt_buy_7 := na
    table_buy_exch_7 := na
    table_buy_para_7 := na
    tbl_count_bg_7 := na
    tbl_count_txt7_1 := na
    tbl_count_txt7_2 := na 
    tbl_count_txt7_3 := na 

//----------------------------------------------------------
// TABLE 8
//----------------------------------------------------------

// text for count
period8_1_txt = period_1_ + str.tostring(count8_1_size)
period8_2_txt = period_2_ + str.tostring(count8_2_size)
period8_3_txt = period_3_ + str.tostring(count8_3_size)

table_sell_bg_8 = table_sell_color
table_sell_txt_8 = table_text_color_sell
table_buy_bg_8 = table_buy_color
table_buy_txt_8 = table_text_color_buy

tbl_count_bg_8 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_8 = "8"
txt_ticker_8 = str.tostring(syminfo.ticker(symbol8_1))
txt_sell_8 = "SELL"
txt_buy_8 = "BUY"
if show_pair_8==false or about_ind
    tbl_spread_bg_8 := na
    tbl_spread_txt2_8 := na
    table_sell_bg_8 := na
    table_sell_txt_8 := na
    table_buy_bg_8 := na
    table_buy_txt_8 := na
    txt_num_8 := na
    spread_txt_8 := na
    txt_ticker_8 := na
    txt_sell_8 := na
    table_sell_exch_8 := na
    table_sell_para_8 := na
    txt_buy_8 := na
    table_buy_exch_8 := na
    table_buy_para_8 := na
    tbl_count_bg_8 := na
    tbl_count_txt8_1 := na
    tbl_count_txt8_2 := na 
    tbl_count_txt8_3 := na 


//----------------------------------------------------------
// TABLE 9
//----------------------------------------------------------

// text for count
period9_1_txt = period_1_ + str.tostring(count9_1_size)
period9_2_txt = period_2_ + str.tostring(count9_2_size)
period9_3_txt = period_3_ + str.tostring(count9_3_size)

table_sell_bg_9 = table_sell_color
table_sell_txt_9 = table_text_color_sell
table_buy_bg_9 = table_buy_color
table_buy_txt_9 = table_text_color_buy

tbl_count_bg_9 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_9 = "9"
txt_ticker_9 = str.tostring(syminfo.ticker(symbol9_1))
txt_sell_9 = "SELL"
txt_buy_9 = "BUY"
if show_pair_9==false
    tbl_spread_bg_9 := na
    tbl_spread_txt2_9 := na
    table_sell_bg_9 := na
    table_sell_txt_9 := na
    table_buy_bg_9 := na
    table_buy_txt_9 := na
    txt_num_9 := na
    spread_txt_9 := na
    txt_ticker_9 := na
    txt_sell_9 := na
    table_sell_exch_9 := na
    table_sell_para_9 := na
    txt_buy_9 := na
    table_buy_exch_9 := na
    table_buy_para_9 := na
    tbl_count_bg_9 := na
    tbl_count_txt9_1 := na
    tbl_count_txt9_2 := na 
    tbl_count_txt9_3 := na 

//----------------------------------------------------------
// TABLE 10
//----------------------------------------------------------

// text for count
period10_1_txt = period_1_ + str.tostring(count10_1_size)
period10_2_txt = period_2_ + str.tostring(count10_2_size)
period10_3_txt = period_3_ + str.tostring(count10_3_size)

table_sell_bg_10 = table_sell_color
table_sell_txt_10 = table_text_color_sell
table_buy_bg_10 = table_buy_color
table_buy_txt_10 = table_text_color_buy

tbl_count_bg_10 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_10 = "10"
txt_ticker_10 = str.tostring(syminfo.ticker(symbol10_1))
txt_sell_10 = "SELL"
txt_buy_10 = "BUY"
if show_pair_10==false
    tbl_spread_bg_10 := na
    tbl_spread_txt2_10 := na
    table_sell_bg_10 := na
    table_sell_txt_10 := na
    table_buy_bg_10 := na
    table_buy_txt_10 := na
    txt_num_10 := na
    spread_txt_10 := na
    txt_ticker_10 := na
    txt_sell_10 := na
    table_sell_exch_10 := na
    table_sell_para_10 := na
    txt_buy_10 := na
    table_buy_exch_10 := na
    table_buy_para_10 := na
    tbl_count_bg_10 := na
    tbl_count_txt10_1 := na
    tbl_count_txt10_2 := na 
    tbl_count_txt10_3 := na 

//----------------------------------------------------------
// TABLE 11
//----------------------------------------------------------

// text for count
period11_1_txt = period_1_ + str.tostring(count11_1_size)
period11_2_txt = period_2_ + str.tostring(count11_2_size)
period11_3_txt = period_3_ + str.tostring(count11_3_size)

table_sell_bg_11 = table_sell_color
table_sell_txt_11 = table_text_color_sell
table_buy_bg_11 = table_buy_color
table_buy_txt_11 = table_text_color_buy

tbl_count_bg_11 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_11 = "11"
txt_ticker_11 = str.tostring(syminfo.ticker(symbol11_1))
txt_sell_11 = "SELL"
txt_buy_11 = "BUY"
if show_pair_11==false or about_ind
    tbl_spread_bg_11 := na
    tbl_spread_txt2_11 := na
    table_sell_bg_11 := na
    table_sell_txt_11 := na
    table_buy_bg_11 := na
    table_buy_txt_11 := na
    txt_num_11 := na
    spread_txt_11 := na
    txt_ticker_11 := na
    txt_sell_11 := na
    table_sell_exch_11 := na
    table_sell_para_11 := na
    txt_buy_11 := na
    table_buy_exch_11 := na
    table_buy_para_11 := na
    tbl_count_bg_11 := na
    tbl_count_txt11_1 := na
    tbl_count_txt11_2 := na 
    tbl_count_txt11_3 := na 

//----------------------------------------------------------
// TABLE 12
//----------------------------------------------------------

// text for count
period12_1_txt = period_1_ + str.tostring(count12_1_size)
period12_2_txt = period_2_ + str.tostring(count12_2_size)
period12_3_txt = period_3_ + str.tostring(count12_3_size)

table_sell_bg_12 = table_sell_color
table_sell_txt_12 = table_text_color_sell
table_buy_bg_12 = table_buy_color
table_buy_txt_12 = table_text_color_buy

tbl_count_bg_12 = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? na 
 : white_theme ? color_bg_w : color_pair_bg

txt_num_12 = "12"
txt_ticker_12 = str.tostring(syminfo.ticker(symbol12_1))
txt_sell_12 = "SELL"
txt_buy_12 = "BUY"
if show_pair_12==false or about_ind
    tbl_spread_bg_12 := na
    tbl_spread_txt2_12 := na
    table_sell_bg_12 := na
    table_sell_txt_12 := na
    table_buy_bg_12 := na
    table_buy_txt_12 := na
    txt_num_12 := na
    spread_txt_12 := na
    txt_ticker_12 := na
    txt_sell_12 := na
    table_sell_exch_12 := na
    table_sell_para_12 := na
    txt_buy_12 := na
    table_buy_exch_12 := na
    table_buy_para_12 := na
    tbl_count_bg_12 := na
    tbl_count_txt12_1 := na
    tbl_count_txt12_2 := na 
    tbl_count_txt12_3 := na 

//----------------------------------------------------------
// TOTAL TABLE
//----------------------------------------------------------

txt_size_ = size.small
txt_size_count = size.tiny
table_width_1_ = table_width_1
table_width_2_ = table_width_2
table_width_price_ = table_width_price
width_frame = width_frame_inp
if txt_size=="Normal"
    txt_size_ := size.normal
    txt_size_count := size.small
//    table_width_1_ := table_width_1 //- 1
//    table_width_2_ := table_width_2 //- 1
//    table_width_price_ := table_width_price //- 1
//    width_frame := width_frame_inp //- 2

table_height_ = table_height //txt_size=="Normal" ? table_height + 1 : table_height
if (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false
    table_height_ := table_height + 2

table_height_count = (show_count_1==false and show_count_2==false and show_count_3==false) or show_counts==false ? -1 : table_height -2

//    set table 
table_1 = table.new(position = position.top_left, columns=17, rows=16, frame_color=color.new(#343434, 100), 
 frame_width=1, border_color=color.new(#141721, 100), border_width=1)

if barstate.islast
// 1
    table.cell(table_id = table_1, column = 1, row = 1, text = txt_num_1, bgcolor = tbl_spread_bg_1, text_color = tbl_spread_txt2_1, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 1, text = spread_txt, bgcolor = tbl_spread_bg_1, text_color = tbl_spread_txt_1, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 3, row = 1, text = txt_ticker_1, bgcolor = tbl_spread_bg_1, text_color = tbl_spread_txt2_1, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 2, text = txt_sell_1, bgcolor = table_sell_bg_1, text_color = table_sell_txt_1, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 2, text = table_sell_exch, bgcolor = table_sell_bg_1, text_color = table_sell_txt_1, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 3, row = 2, text = table_sell_para, bgcolor = table_sell_bg_1, text_color = table_sell_txt_1, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 3, text = txt_buy_1, bgcolor = table_buy_bg_1, text_color = table_buy_txt_1, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 3, text = table_buy_exch, bgcolor = table_buy_bg_1, text_color = table_buy_txt_1, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 3, row = 3, text = table_buy_para, bgcolor = table_buy_bg_1, text_color = table_buy_txt_1, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 4, text = period1_1_txt, bgcolor = tbl_count_bg_1, text_color = tbl_count_txt1_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 2, row = 4, text = period1_2_txt, bgcolor = tbl_count_bg_1, text_color = tbl_count_txt1_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 3, row = 4, text = period1_3_txt, bgcolor = tbl_count_bg_1, text_color = tbl_count_txt1_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 2 
    table.cell(table_id = table_1, column = 5, row = 1, text = txt_num_2, bgcolor = tbl_spread_bg_2, text_color = tbl_spread_txt2_2, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 1, text = spread_txt_2, bgcolor = tbl_spread_bg_2, text_color = tbl_spread_txt_2, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 7, row = 1, text = txt_ticker_2, bgcolor = tbl_spread_bg_2, text_color = tbl_spread_txt2_2, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 2, text = txt_sell_2, bgcolor = table_sell_bg_2, text_color = table_sell_txt_2, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 2, text = table_sell_exch_2, bgcolor = table_sell_bg_2, text_color = table_sell_txt_2, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 7, row = 2, text = table_sell_para_2, bgcolor = table_sell_bg_2, text_color = table_sell_txt_2, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 3, text = txt_buy_2, bgcolor = table_buy_bg_2, text_color = table_buy_txt_2, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 3, text = table_buy_exch_2, bgcolor = table_buy_bg_2, text_color = table_buy_txt_2, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 7, row = 3, text = table_buy_para_2, bgcolor = table_buy_bg_2, text_color = table_buy_txt_2, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 4, text = period2_1_txt, bgcolor = tbl_count_bg_2, text_color = tbl_count_txt2_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 6, row = 4, text = period2_2_txt, bgcolor = tbl_count_bg_2, text_color = tbl_count_txt2_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 7, row = 4, text = period2_3_txt, bgcolor = tbl_count_bg_2, text_color = tbl_count_txt2_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 3 
    table.cell(table_id = table_1, column = 9, row = 1, text = txt_num_3, bgcolor = tbl_spread_bg_3, text_color = tbl_spread_txt2_3, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 1, text = spread_txt_3, bgcolor = tbl_spread_bg_3, text_color = tbl_spread_txt_3, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 11, row = 1, text = txt_ticker_3, bgcolor = tbl_spread_bg_3, text_color = tbl_spread_txt2_3, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 2, text = txt_sell_3, bgcolor = table_sell_bg_3, text_color = table_sell_txt_3, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 2, text = table_sell_exch_3, bgcolor = table_sell_bg_3, text_color = table_sell_txt_3, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 11, row = 2, text = table_sell_para_3, bgcolor = table_sell_bg_3, text_color = table_sell_txt_3, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 3, text = txt_buy_3, bgcolor = table_buy_bg_3, text_color = table_buy_txt_3, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 3, text = table_buy_exch_3, bgcolor = table_buy_bg_3, text_color = table_buy_txt_3, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 11, row = 3, text = table_buy_para_3, bgcolor = table_buy_bg_3, text_color = table_buy_txt_3, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 4, text = period3_1_txt, bgcolor = tbl_count_bg_3, text_color = tbl_count_txt3_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 10, row = 4, text = period3_2_txt, bgcolor = tbl_count_bg_3, text_color = tbl_count_txt3_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 11, row = 4, text = period3_3_txt, bgcolor = tbl_count_bg_3, text_color = tbl_count_txt3_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 4 
    table.cell(table_id = table_1, column = 13, row = 1, text = txt_num_4, bgcolor = tbl_spread_bg_4, text_color = tbl_spread_txt2_4, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 1, text = spread_txt_4, bgcolor = tbl_spread_bg_4, text_color = tbl_spread_txt_4, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 15, row = 1, text = txt_ticker_4, bgcolor = tbl_spread_bg_4, text_color = tbl_spread_txt2_4, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 2, text = txt_sell_4, bgcolor = table_sell_bg_4, text_color = table_sell_txt_4, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 2, text = table_sell_exch_4, bgcolor = table_sell_bg_4, text_color = table_sell_txt_4, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 15, row = 2, text = table_sell_para_4, bgcolor = table_sell_bg_4, text_color = table_sell_txt_4, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 3, text = txt_buy_4, bgcolor = table_buy_bg_4, text_color = table_buy_txt_4, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 3, text = table_buy_exch_4, bgcolor = table_buy_bg_4, text_color = table_buy_txt_4, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 15, row = 3, text = table_buy_para_4, bgcolor = table_buy_bg_4, text_color = table_buy_txt_4, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 4, text = period4_1_txt, bgcolor = tbl_count_bg_4, text_color = tbl_count_txt4_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 14, row = 4, text = period4_2_txt, bgcolor = tbl_count_bg_4, text_color = tbl_count_txt4_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 15, row = 4, text = period4_3_txt, bgcolor = tbl_count_bg_4, text_color = tbl_count_txt4_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 5 
    table.cell(table_id = table_1, column = 1, row = 6, text = txt_num_5, bgcolor = tbl_spread_bg_5, text_color = tbl_spread_txt2_5, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 6, text = spread_txt_5, bgcolor = tbl_spread_bg_5, text_color = tbl_spread_txt_5, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 3, row = 6, text = txt_ticker_5, bgcolor = tbl_spread_bg_5, text_color = tbl_spread_txt2_5, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 7, text = txt_sell_5, bgcolor = table_sell_bg_5, text_color = table_sell_txt_5, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 7, text = table_sell_exch_5, bgcolor = table_sell_bg_5, text_color = table_sell_txt_5, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 3, row = 7, text = table_sell_para_5, bgcolor = table_sell_bg_5, text_color = table_sell_txt_5, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 8, text = txt_buy_5, bgcolor = table_buy_bg_5, text_color = table_buy_txt_5, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 8, text = table_buy_exch_5, bgcolor = table_buy_bg_5, text_color = table_buy_txt_5, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 3, row = 8, text = table_buy_para_5, bgcolor = table_buy_bg_5, text_color = table_buy_txt_5, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 9, text = period5_1_txt, bgcolor = tbl_count_bg_5, text_color = tbl_count_txt5_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 2, row = 9, text = period5_2_txt, bgcolor = tbl_count_bg_5, text_color = tbl_count_txt5_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 3, row = 9, text = period5_3_txt, bgcolor = tbl_count_bg_5, text_color = tbl_count_txt5_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 6 
    table.cell(table_id = table_1, column = 5, row = 6, text = txt_num_6, bgcolor = tbl_spread_bg_6, text_color = tbl_spread_txt2_6, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 6, text = spread_txt_6, bgcolor = tbl_spread_bg_6, text_color = tbl_spread_txt_6, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 7, row = 6, text = txt_ticker_6, bgcolor = tbl_spread_bg_6, text_color = tbl_spread_txt2_6, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 7, text = txt_sell_6, bgcolor = table_sell_bg_6, text_color = table_sell_txt_6, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 7, text = table_sell_exch_6, bgcolor = table_sell_bg_6, text_color = table_sell_txt_6, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 7, row = 7, text = table_sell_para_6, bgcolor = table_sell_bg_6, text_color = table_sell_txt_6, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 8, text = txt_buy_6, bgcolor = table_buy_bg_6, text_color = table_buy_txt_6, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 8, text = table_buy_exch_6, bgcolor = table_buy_bg_6, text_color = table_buy_txt_6, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 7, row = 8, text = table_buy_para_6, bgcolor = table_buy_bg_6, text_color = table_buy_txt_6, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 9, text = period6_1_txt, bgcolor = tbl_count_bg_6, text_color = tbl_count_txt6_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 6, row = 9, text = period6_2_txt, bgcolor = tbl_count_bg_6, text_color = tbl_count_txt6_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 7, row = 9, text = period6_3_txt, bgcolor = tbl_count_bg_6, text_color = tbl_count_txt6_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 7 
    table.cell(table_id = table_1, column = 9, row = 6, text = txt_num_7, bgcolor = tbl_spread_bg_7, text_color = tbl_spread_txt2_7, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 6, text = spread_txt_7, bgcolor = tbl_spread_bg_7, text_color = tbl_spread_txt_7, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 11, row = 6, text = txt_ticker_7, bgcolor = tbl_spread_bg_7, text_color = tbl_spread_txt2_7, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 7, text = txt_sell_7, bgcolor = table_sell_bg_7, text_color = table_sell_txt_7, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 7, text = table_sell_exch_7, bgcolor = table_sell_bg_7, text_color = table_sell_txt_7, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 11, row = 7, text = table_sell_para_7, bgcolor = table_sell_bg_7, text_color = table_sell_txt_7, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 8, text = txt_buy_7, bgcolor = table_buy_bg_7, text_color = table_buy_txt_7, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 8, text = table_buy_exch_7, bgcolor = table_buy_bg_7, text_color = table_buy_txt_7, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 11, row = 8, text = table_buy_para_7, bgcolor = table_buy_bg_7, text_color = table_buy_txt_7, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 9, text = period7_1_txt, bgcolor = tbl_count_bg_7, text_color = tbl_count_txt7_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 10, row = 9, text = period7_2_txt, bgcolor = tbl_count_bg_7, text_color = tbl_count_txt7_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 11, row = 9, text = period7_3_txt, bgcolor = tbl_count_bg_7, text_color = tbl_count_txt7_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 8 
    table.cell(table_id = table_1, column = 13, row = 6, text = txt_num_8, bgcolor = tbl_spread_bg_8, text_color = tbl_spread_txt2_8, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 6, text = spread_txt_8, bgcolor = tbl_spread_bg_8, text_color = tbl_spread_txt_8, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 15, row = 6, text = txt_ticker_8, bgcolor = tbl_spread_bg_8, text_color = tbl_spread_txt2_8, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 7, text = txt_sell_8, bgcolor = table_sell_bg_8, text_color = table_sell_txt_8, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 7, text = table_sell_exch_8, bgcolor = table_sell_bg_8, text_color = table_sell_txt_8, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 15, row = 7, text = table_sell_para_8, bgcolor = table_sell_bg_8, text_color = table_sell_txt_8, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 8, text = txt_buy_8, bgcolor = table_buy_bg_8, text_color = table_buy_txt_8, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 8, text = table_buy_exch_8, bgcolor = table_buy_bg_8, text_color = table_buy_txt_8, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 15, row = 8, text = table_buy_para_8, bgcolor = table_buy_bg_8, text_color = table_buy_txt_8, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 9, text = period8_1_txt, bgcolor = tbl_count_bg_8, text_color = tbl_count_txt8_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 14, row = 9, text = period8_2_txt, bgcolor = tbl_count_bg_8, text_color = tbl_count_txt8_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 15, row = 9, text = period8_3_txt, bgcolor = tbl_count_bg_8, text_color = tbl_count_txt8_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 9 
    table.cell(table_id = table_1, column = 1, row = 11, text = txt_num_9, bgcolor = tbl_spread_bg_9, text_color = tbl_spread_txt2_9, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 11, text = spread_txt_9, bgcolor = tbl_spread_bg_9, text_color = tbl_spread_txt_9, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 3, row = 11, text = txt_ticker_9, bgcolor = tbl_spread_bg_9, text_color = tbl_spread_txt2_9, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 12, text = txt_sell_9, bgcolor = table_sell_bg_9, text_color = table_sell_txt_9, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 12, text = table_sell_exch_9, bgcolor = table_sell_bg_9, text_color = table_sell_txt_9, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 3, row = 12, text = table_sell_para_9, bgcolor = table_sell_bg_9, text_color = table_sell_txt_9, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 13, text = txt_buy_9, bgcolor = table_buy_bg_9, text_color = table_buy_txt_9, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 2, row = 13, text = table_buy_exch_9, bgcolor = table_buy_bg_9, text_color = table_buy_txt_9, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 3, row = 13, text = table_buy_para_9, bgcolor = table_buy_bg_9, text_color = table_buy_txt_9, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 1, row = 14, text = period9_1_txt, bgcolor = tbl_count_bg_9, text_color = tbl_count_txt9_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 2, row = 14, text = period9_2_txt, bgcolor = tbl_count_bg_9, text_color = tbl_count_txt9_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 3, row = 14, text = period9_3_txt, bgcolor = tbl_count_bg_9, text_color = tbl_count_txt9_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 10 
    table.cell(table_id = table_1, column = 5, row = 11, text = txt_num_10, bgcolor = tbl_spread_bg_10, text_color = tbl_spread_txt2_10, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 11, text = spread_txt_10, bgcolor = tbl_spread_bg_10, text_color = tbl_spread_txt_10, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 7, row = 11, text = txt_ticker_10, bgcolor = tbl_spread_bg_10, text_color = tbl_spread_txt2_10, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 12, text = txt_sell_10, bgcolor = table_sell_bg_10, text_color = table_sell_txt_10, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 12, text = table_sell_exch_10, bgcolor = table_sell_bg_10, text_color = table_sell_txt_10, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 7, row = 12, text = table_sell_para_10, bgcolor = table_sell_bg_10, text_color = table_sell_txt_10, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 13, text = txt_buy_10, bgcolor = table_buy_bg_10, text_color = table_buy_txt_10, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 6, row = 13, text = table_buy_exch_10, bgcolor = table_buy_bg_10, text_color = table_buy_txt_10, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 7, row = 13, text = table_buy_para_10, bgcolor = table_buy_bg_10, text_color = table_buy_txt_10, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 5, row = 14, text = period10_1_txt, bgcolor = tbl_count_bg_10, text_color = tbl_count_txt10_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 6, row = 14, text = period10_2_txt, bgcolor = tbl_count_bg_10, text_color = tbl_count_txt10_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 7, row = 14, text = period10_3_txt, bgcolor = tbl_count_bg_10, text_color = tbl_count_txt10_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 11 
    table.cell(table_id = table_1, column = 9, row = 11, text = txt_num_11, bgcolor = tbl_spread_bg_11, text_color = tbl_spread_txt2_11, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 11, text = spread_txt_11, bgcolor = tbl_spread_bg_11, text_color = tbl_spread_txt_11, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 11, row = 11, text = txt_ticker_11, bgcolor = tbl_spread_bg_11, text_color = tbl_spread_txt2_11, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 12, text = txt_sell_11, bgcolor = table_sell_bg_11, text_color = table_sell_txt_11, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 12, text = table_sell_exch_11, bgcolor = table_sell_bg_11, text_color = table_sell_txt_11, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 11, row = 12, text = table_sell_para_11, bgcolor = table_sell_bg_11, text_color = table_sell_txt_11, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 13, text = txt_buy_11, bgcolor = table_buy_bg_11, text_color = table_buy_txt_11, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 10, row = 13, text = table_buy_exch_11, bgcolor = table_buy_bg_11, text_color = table_buy_txt_11, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 11, row = 13, text = table_buy_para_11, bgcolor = table_buy_bg_11, text_color = table_buy_txt_11, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 9, row = 14, text = period11_1_txt, bgcolor = tbl_count_bg_11, text_color = tbl_count_txt11_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 10, row = 14, text = period11_2_txt, bgcolor = tbl_count_bg_11, text_color = tbl_count_txt11_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 11, row = 14, text = period11_3_txt, bgcolor = tbl_count_bg_11, text_color = tbl_count_txt11_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

// 12 
    table.cell(table_id = table_1, column = 13, row = 11, text = txt_num_12, bgcolor = tbl_spread_bg_12, text_color = tbl_spread_txt2_12, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 11, text = spread_txt_12, bgcolor = tbl_spread_bg_12, text_color = tbl_spread_txt_12, width = table_width_2_, height = table_height_, text_size = txt_size_) 
    table.cell(table_id = table_1, column = 15, row = 11, text = txt_ticker_12, bgcolor = tbl_spread_bg_12, text_color = tbl_spread_txt2_12, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 12, text = txt_sell_12, bgcolor = table_sell_bg_12, text_color = table_sell_txt_12, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 12, text = table_sell_exch_12, bgcolor = table_sell_bg_12, text_color = table_sell_txt_12, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 15, row = 12, text = table_sell_para_12, bgcolor = table_sell_bg_12, text_color = table_sell_txt_12, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 13, text = txt_buy_12, bgcolor = table_buy_bg_12, text_color = table_buy_txt_12, width = table_width_1_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 14, row = 13, text = table_buy_exch_12, bgcolor = table_buy_bg_12, text_color = table_buy_txt_12, width = table_width_2_, height = table_height_, text_size = txt_size_)
    table.cell(table_id = table_1, column = 15, row = 13, text = table_buy_para_12, bgcolor = table_buy_bg_12, text_color = table_buy_txt_12, width = table_width_price_, height = table_height_, text_size = txt_size_)

    table.cell(table_id = table_1, column = 13, row = 14, text = period12_1_txt, bgcolor = tbl_count_bg_12, text_color = tbl_count_txt12_1, width = table_width_1_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 14, row = 14, text = period12_2_txt, bgcolor = tbl_count_bg_12, text_color = tbl_count_txt12_2, width = table_width_2_, height = table_height_count, text_size=txt_size_count)
    table.cell(table_id = table_1, column = 15, row = 14, text = period12_3_txt, bgcolor = tbl_count_bg_12, text_color = tbl_count_txt12_3, width = table_width_price_, height = table_height_count, text_size=txt_size_count)

//1 gorizont frame
    table.cell(table_id = table_1, column = 0, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = top_indentation)
    table.cell(table_id = table_1, column = 1, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 2, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 3, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 4, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame, width = width_frame, height = top_indentation)
    table.cell(table_id = table_1, column = 5, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 6, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 7, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 8, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame, width = width_frame, height = top_indentation)
    table.cell(table_id = table_1, column = 9, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 10, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame, height = top_indentation)
    table.cell(table_id = table_1, column = 11, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 12, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame, width = width_frame, height = top_indentation)
    table.cell(table_id = table_1, column = 13, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 14, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 15, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
    table.cell(table_id = table_1, column = 16, row = 0, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = top_indentation)
//2 gorizont frame
    table.cell(table_id = table_1, column = 0, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = height_frame)
    table.cell(table_id = table_1, column = 1, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 2, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 3, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 4, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 5, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 6, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 7, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 8, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 9, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 10, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 11, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 12, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 13, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 14, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 15, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 16, row = 5, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
//3 gorizont frame
    table.cell(table_id = table_1, column = 0, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = height_frame)
    table.cell(table_id = table_1, column = 1, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 2, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 3, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 4, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 5, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 6, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 7, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 8, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 9, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 10, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame, height = height_frame)
    table.cell(table_id = table_1, column = 11, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame, height = height_frame)
    table.cell(table_id = table_1, column = 12, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame, height = height_frame)
    table.cell(table_id = table_1, column = 13, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame, height = height_frame)
    table.cell(table_id = table_1, column = 14, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 15, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
    table.cell(table_id = table_1, column = 16, row = 10, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = height_frame)
//4 gorizont frame
    table.cell(table_id = table_1, column = 0, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = bottom_indentation)
    table.cell(table_id = table_1, column = 1, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 2, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 3, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 4, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 5, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 6, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 7, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 8, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 9, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 10, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 11, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 12, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 13, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 14, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 15, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)
    table.cell(table_id = table_1, column = 16, row = 15, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = bottom_indentation)

// 1 pair
    table.cell(table_id = table_1, column = 0, row = 1, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 2, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 3, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 4, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height_count)
// 5 pair
    table.cell(table_id = table_1, column = 0, row = 6, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 7, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 8, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 9, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height_count)
// 9 pair
    table.cell(table_id = table_1, column = 0, row = 11, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 12, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 13, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height)
    table.cell(table_id = table_1, column = 0, row = 14, text = "", bgcolor = color_frame, text_color = text_color_frame, width = right_indentation, height = table_height_count)
// 2 pair
    table.cell(table_id = table_1, column = 4, row = 1, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 2, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 3, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 4, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 6 pair
    table.cell(table_id = table_1, column = 4, row = 6, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 7, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 8, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 9, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 10 pair
    table.cell(table_id = table_1, column = 4, row = 11, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 12, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 13, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 4, row = 14, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 3 pair
    table.cell(table_id = table_1, column = 8, row = 1, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 2, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 3, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 4, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 7 pair
    table.cell(table_id = table_1, column = 8, row = 6, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 7, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 8, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 9, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 11 pair
    table.cell(table_id = table_1, column = 8, row = 11, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 12, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 13, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 8, row = 14, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 13 vert frame - front 4, 8, 12 para
    table.cell(table_id = table_1, column = 12, row = 1, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 2, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 3, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 4, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
    table.cell(table_id = table_1, column = 12, row = 6, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 7, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 8, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 9, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
    table.cell(table_id = table_1, column = 12, row = 11, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 12, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 13, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 12, row = 14, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
// 14 vert frame - end 4, 8, 12 para
    table.cell(table_id = table_1, column = 16, row = 1, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 2, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 3, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 4, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
    table.cell(table_id = table_1, column = 16, row = 6, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 7, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 8, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 9, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)
    table.cell(table_id = table_1, column = 16, row = 11, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 12, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 13, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height)
    table.cell(table_id = table_1, column = 16, row = 14, text = "", bgcolor = color_frame, text_color = text_color_frame,  height = table_height_count)


//----------------------------------------------------------
// ABOUT
//----------------------------------------------------------

top_indentation_about = 6 // input.int(2, title = "top_indentation")
bottom_indentation_about = 3 // input.int(2, title = "bottom_indentation")

width_tb2 = 46 // input.int(46, title = "Width Table Info", group = "tbl2")
width_frame_tbl2 = 2 //input.int(1, title = "Width Frame Left")
height_tbl2_inp = 90 // input.int(90, title = "Height")
height_tbl2 = height_tbl2_inp
tbl2_bg = table_buy_bg
txt_color_tbl2 = table_buy_txt
text_tbl2 = "\n\nABOUT INDICATOR & US \n\nIn the indicator settings menu, the user selects two trading pairs, after which the script \nwill receive prices for both and compare them with each other, calculating the \npercentage deviation between prices (spread). This setting can be made for 12 trading \npairs. These can be pairs with the same ticker but on different exchanges, you can \ncompare spot and futures, you can compare generally different tickers, anything. \n\nYou can set the threshold value of the spread, at which the script will send alerts from \nTradingView – Spread Signal Threshold. This threshold level is common to all trading \npairs, so alerts will be sent when this spread level is reached for any of them. \n\nWe - the authors of this script - have been engaged in cryptocurrency arbitrage since \n2018 and first of all we created it for ourselves and our daily arbitrage trading, \nbut this does not prevent you from using it at your discretion for any types of assets \nand in any markets. For more information about the indicator and other our scripts see \nthe description of the indicator on our TradingView page. \n\n-\n\nОБ ИНДИКАТОРЕ И НАС \n\nВ меню настроек индикатора пользователь выбирает две торговые пары, после чего \nскрипт получит цены по обеим и сравнит их между собой, рассчитав процентное \nотклонение между ценами (спред). Такую настройку можно произвести для 12 \nторговых пар. Это могут быть пары с одним и тем же тикером но на разных биржах,\nможно сравнить спот и фьючерсы, можно сравнить вообще разные тикеры, все что \nугодно. \n\nВы можете настроить пороговое значение спреда, при достижении которого скрипт \nбудет отправлять уведомления от TradingViewSpread Signal Threshold. Этот \nпороговый уровень является общим для всех торговых пар, поэтому уведомления \nбудут приходить при достижении этого уровня спреда по любой из них.\n\nМы, авторы данного скрипта, занимаемся арбитражем криптовалюты c 2018, \nи, в первую очередь, создавали его для себя и своей каждодневной арбитражной \nторговли, но это не мешает вам использовать его по своему усмотрению \nдля любых видов активов и на любых рынках. Более подробно об индикаторе и о \nдругих скриптах читайте в описании индикатора на нашей странице TradingView." 

color color_frame_about = na

width_tb2_ = txt_size=="Normal" ? 61 : width_tb2

side_tbl2 = position.top_right

table_info = table.new(position = side_tbl2, columns=3, rows=3, frame_color=tbl2_bg, 
 frame_width=0, border_color=tbl2_bg, border_width=0)

if barstate.islast and about_ind==true //or about_arby==true)
    table.cell(table_id = table_info, column = 0, row = 0, text = "", bgcolor = color_frame_about, text_color = color_frame, width = width_frame_tbl2, height = top_indentation_about)
    table.cell(table_id = table_info, column = 1, row = 0, text = "", bgcolor = color_frame_about, text_color = color_frame, width = width_tb2_, height = top_indentation_about)
    table.cell(table_id = table_info, column = 2, row = 0, text = "", bgcolor = color_frame_about, text_color = color_frame, width = width_frame_tbl2, height = top_indentation_about)

    table.cell(table_id = table_info, column = 0, row = 1, text = "", bgcolor = tbl2_bg, text_color = txt_color_tbl2, width = width_frame_tbl2, height = height_tbl2)
    table.cell(table_id = table_info, column = 1, row = 1, text = text_tbl2, bgcolor = tbl2_bg, text_color = txt_color_tbl2, width = width_tb2_, height = height_tbl2, text_halign=text.align_left, text_valign= text.align_top, text_size = txt_size_)
    table.cell(table_id = table_info, column = 2, row = 1, text = "", bgcolor = tbl2_bg, text_color = txt_color_tbl2, width = width_frame_tbl2, height = height_tbl2)

    table.cell(table_id = table_info, column = 0, row = 2, text = "", bgcolor = color_frame_about, text_color = color_frame, width = width_frame_tbl2, height = bottom_indentation_about)
    table.cell(table_id = table_info, column = 1, row = 2, text = "", bgcolor = color_frame_about, text_color = color_frame, width = width_tb2_, height = bottom_indentation_about)
    table.cell(table_id = table_info, column = 2, row = 2, text = "", bgcolor = color_frame_about, text_color = color_frame, width = width_frame_tbl2, height = bottom_indentation_about)