Number of Bars CheatSheet
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © thebearfib

//@version=5
indicator("Number of Bars CheatSheet", overlay = true)

showxE       = input.bool(defval = true, title = "🏦 Show Bars CheatSheet: ")

_fontSize1  = input.string("Normal","🗚 - Font Size", options = [ "Auto", "Tiny", "Small", "Normal", "Large", "Huge"])

position3b   = input.string("Top Right","- Table Position",
  options  = ["Top Right", "Top Center", "Top Left", "Middle Right", "Middle Center", "Middle Left", "Bottom Right", "Bottom Center", "Bottom Left"])

//
// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
// ————————————————————————————————— Table Layouts ————————————————————————————————————————————————————————————————————————
// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
//

_fontSize   = switch _fontSize1
    
    "Normal"    => size.normal
    "Auto"      => size.auto
    "Tiny"      => size.tiny
    "Small"     => size.small
    "Large"     => size.large
    "Huge"      => size.huge


tableposGo2 = switch position3b
    
    "Top Right"     => position.top_right
    "Top Center"    => position.top_center
    "Top Left"      => position.top_left
    "Middle Right"  => position.middle_right
    "Middle Center" => position.middle_center
    "Middle Left"   => position.middle_left
    "Bottom Right"  => position.bottom_right
    "Bottom Center" => position.bottom_center
    "Bottom Left"   => position.bottom_left

if barstate.islast or barstate.islastconfirmedhistory
    var table tab = table.new(tableposGo2, 99, 99,
      bgcolor = color.rgb(255, 255, 255, 100),
      frame_color=color.rgb(255, 255, 255, 100),
      frame_width = 1,  
      border_color =color.rgb(255, 255, 255, 100),
      border_width = 1)

    if showxE
        table.cell(tab, 1, 1, "Chart \nTime ", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 1, "No. Bars \nin RTH",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 2, "1min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 2, "390",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 3, "2min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 3, "195",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 4, "3min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 4, "130",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 5, "5min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 5, "78",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 6, "7min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 6, "56",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 7, "10min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 7, "39",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 8, "15min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 8, "26",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 9, "30min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 9, "13",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 10, "45min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 10, "9",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)
                
        table.cell(tab, 1, 11, "65min ", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 11, "6",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)
                
        table.cell(tab, 1, 12, "1hr", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 12, "7",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)
        
        table.cell(tab, 1, 13, "2hr", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 13, "4",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 14, "4hr", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 14, "2",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)

        table.cell(tab, 1, 15, "195min", text_color = color.white,text_halign = text.align_left , text_size = _fontSize)
        table.cell(tab, 2, 15, "2",  text_color = color.white,text_halign = text.align_left, text_size = _fontSize)



