Syminfo [Epi]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Epi_
//@version=5
indicator("Syminfo [Epi]","Syminfo",true)

//=== Inputs ===
var color ctransp=color.new(color.white,100)
syminfo_label_offset=input.int(10,"Label offset horizontal")
syminfo_label_center=input.int(10,"Label centered around prices of last x bars",minval=1,maxval=5000)
syminfo_label_ctext=input.color(color.black,"Color text, background",inline="Color")
syminfo_label_cback=input.color(ctransp,"",inline="Color")
syminfo_label_style=input.string(label.style_label_left,"Label style, size",options=[label.style_label_left,label.style_label_right,label.style_label_center,label.style_label_up,label.style_label_down,label.style_label_lower_left,label.style_label_lower_right,label.style_label_upper_left,label.style_label_upper_right,label.style_none],inline="Label")
// Other styles (not useful with texts): label.style_square,label.style_diamond,label.style_flag,label.style_cross,label.style_xcross,label.style_triangleup,label.style_triangledown,label.style_circle,label.style_arrowup,label.style_arrowdown
syminfo_label_size=input.string(size.small,"",options=[size.auto,size.tiny,size.small,size.normal,size.large,size.huge],inline="Label")

//=== Calculations ===
var string syminfo_text="Description: "+syminfo.description+(na(syminfo.description)?"(na)":"")+
     "\nType: "+syminfo.type+(na(syminfo.type)?"(na)":"")+
     "\nTickerId: "+syminfo.tickerid+(na(syminfo.tickerid)?"(na)":"")+
     "\nPrefix: "+syminfo.prefix+(na(syminfo.prefix)?"(na)":"")+
     "\nTicker: "+syminfo.ticker+(na(syminfo.ticker)?"(na)":"")+
     "\nRoot: "+syminfo.root+(na(syminfo.root)?"(na)":"")+
     "\nCurrency: "+syminfo.currency+(na(syminfo.currency)?"(na)":"")+
     "\nBase currency: "+syminfo.basecurrency+(na(syminfo.basecurrency)?"(na)":"")+
     "\nMinTick: "+str.tostring(syminfo.mintick)+(na(syminfo.mintick)?"(na)":"")+
     "\nPoint value: "+str.tostring(syminfo.pointvalue)+(na(syminfo.pointvalue)?"(na)":"")+
     "\nSession: "+syminfo.session+(na(syminfo.session)?"(na)":"")+
     "\nTimezone: "+syminfo.timezone+(na(syminfo.timezone)?"(na)":"")+
     "\nVolume type: "+syminfo.volumetype+(na(syminfo.volumetype)?"(na)":"")+
     "\nSector: "+syminfo.sector+(na(syminfo.sector)?"(na)":"")+
     "\nIndustry: "+syminfo.industry+(na(syminfo.industry)?"(na)":"")+
     "\nCountry of listing: "+syminfo.country+(na(syminfo.country)?"(na)":"")
var label syminfo_label=na
syminfo_label_pos=ta.sma(close,syminfo_label_center)

//=== Outputs ===
if barstate.islast
    if na(syminfo_label)
        syminfo_label:=label.new(bar_index+syminfo_label_offset,syminfo_label_pos,syminfo_text,xloc.bar_index,yloc.price,syminfo_label_cback,syminfo_label_style,syminfo_label_ctext,syminfo_label_size,text.align_left,"Syminfo values of the ticker")
    else
        label.set_xy(syminfo_label,bar_index+syminfo_label_offset,syminfo_label_pos)
        na
