Symbol Info
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Munkhtur

//@version=5
indicator("Symbol Info", shorttitle = "Info", overlay = true)

Vertical    = input.string("top",      "", inline = "1", options = ["top", "middle", "bottom"], group ="Position")
Horizontal  = input.string("right",    "", inline = "1", options = ["left", "center", "right"], group ="Position", tooltip = "Shows on the selected location")
First       = input.string("Ticker",   "", inline = "2", options = ["Ticker", "Timeframe", ""], group ="Symbol info")
Second      = input.string("Timeframe","", inline = "2", options = ["Ticker", "Timeframe", ""], group ="Symbol info", tooltip = "Shows Symbol info in order")
textsize    = input.string("small",    "Size",                       inline = "3", options = ["tiny", "small", "normal", "large", "huge", "auto"], group ="Text settings")
text_color  = input.color (color.new(color.blue,   0), "Color",      inline = "3", group ="Text settings")
background  = input.color (color.new(color.gray, 100), 'Background', inline = "3", group ="Text settings")
text1     = input.string("Do Your Own Research✔️【DYOR】",  "Text 1", inline = "4", group ="Text", tooltip = "Texts automatically switches")
text2     = input.string("Not Financial Advice❌【NFA】", "Text 2", inline = "4", group ="Text")

var Symbol_info = table.new(Vertical + '_' + Horizontal, 1, 2)
period = timeframe.period
string symbol     = ""
string timeframe  = ""
string ticker     = ""

ticker    := (syminfo.ticker + " ")
timeframe := switch
    period == "S"     => "1S "
    period == "60"    => "1H "
    period == "120"   => "2H "
    period == "180"   => "3H "
    period == "240"   => "4H "
    period == "360"   => "6H "
    => period + (timeframe.isminutes ? "M " : "")

Column_1 = switch First
    "Ticker"        => ticker
    "Timeframe"     => timeframe
Column_2 = switch Second
    "Ticker"        => ticker
    "Timeframe"     => timeframe
symbol := Column_1 + (Column_1 == "" ? "" : "") + Column_2

if barstate.islast
    varip bool changeText = true
    changeText := not changeText
    text_switch = str.length(text2) != 0 and changeText ? text2 : text1
    table.cell(Symbol_info, 0, 0, symbol, 0, 0, text_color, text.align_right, text_size = textsize, bgcolor = background)
    table.cell(Symbol_info, 0, 1, text_switch, 0, 0, text_color, text_size = textsize, bgcolor = background)    


