Gann Square 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Mr_Amiiin_n

//@version=5
indicator('Gann Square', overlay=true)

//set background color
bg = input.color(#7ca5ff, "square diagonals color")
bgDefault = input.color(#9e9e9e, "cells color")
txtColor = input.color(#212121, "numbers color")

//gann square 19*19
var table t = table.new(position.top_right, 19, 19, frame_color=color.rgb(255, 230, 204), frame_width=1, border_color=color.rgb(255, 230, 204), border_width=1)

//c0
table.cell(t, 0, 0, str.tostring(307), text_color=txtColor, bgcolor=bg)
table.cell(t, 1, 0, str.tostring(308), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 0, str.tostring(309), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 0, str.tostring(310), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 0, str.tostring(311), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 0, str.tostring(312), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 0, str.tostring(313), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 0, str.tostring(314), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 0, str.tostring(315), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 0, str.tostring(316), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 0, str.tostring(317), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 0, str.tostring(318), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 0, str.tostring(319), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 0, str.tostring(320), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 0, str.tostring(321), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 0, str.tostring(322), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 0, str.tostring(323), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 0, str.tostring(324), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 0, str.tostring(325), text_color=txtColor, bgcolor=bg)

//c1
table.cell(t, 0, 1, str.tostring(306), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 1, str.tostring(241), text_color=txtColor, bgcolor=bg)
table.cell(t, 2, 1, str.tostring(242), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 1, str.tostring(243), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 1, str.tostring(244), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 1, str.tostring(245), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 1, str.tostring(246), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 1, str.tostring(247), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 1, str.tostring(248), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 1, str.tostring(249), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 1, str.tostring(250), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 1, str.tostring(251), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 1, str.tostring(252), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 1, str.tostring(253), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 1, str.tostring(254), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 1, str.tostring(255), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 1, str.tostring(256), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 1, str.tostring(257), text_color=txtColor, bgcolor=bg)
table.cell(t, 18, 1, str.tostring(326), text_color=txtColor, bgcolor = bgDefault)

//c2
table.cell(t, 0, 2, str.tostring(305), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 2, str.tostring(240), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 2, str.tostring(183), text_color=txtColor, bgcolor=bg)
table.cell(t, 3, 2, str.tostring(184), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 2, str.tostring(185), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 2, str.tostring(186), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 2, str.tostring(187), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 2, str.tostring(188), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 2, str.tostring(189), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 2, str.tostring(190), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 2, str.tostring(191), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 2, str.tostring(192), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 2, str.tostring(193), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 2, str.tostring(194), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 2, str.tostring(195), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 2, str.tostring(196), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 2, str.tostring(197), text_color=txtColor, bgcolor=bg)
table.cell(t, 17, 2, str.tostring(258), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 2, str.tostring(327), text_color=txtColor, bgcolor = bgDefault)

//c3
table.cell(t, 0, 3, str.tostring(304), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 3, str.tostring(239), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 3, str.tostring(182), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 3, str.tostring(133), text_color=txtColor, bgcolor=bg)
table.cell(t, 4, 3, str.tostring(134), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 3, str.tostring(135), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 3, str.tostring(136), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 3, str.tostring(137), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 3, str.tostring(138), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 3, str.tostring(139), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 3, str.tostring(140), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 3, str.tostring(141), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 3, str.tostring(142), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 3, str.tostring(143), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 3, str.tostring(144), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 3, str.tostring(145), text_color=txtColor, bgcolor=bg)
table.cell(t, 16, 3, str.tostring(198), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 3, str.tostring(259), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 3, str.tostring(328), text_color=txtColor, bgcolor = bgDefault)

//c4
table.cell(t, 0, 4, str.tostring(303), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 4, str.tostring(238), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 4, str.tostring(181), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 4, str.tostring(132), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 4, str.tostring(91), text_color=txtColor, bgcolor=bg)
table.cell(t, 5, 4, str.tostring(92), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 4, str.tostring(93), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 4, str.tostring(94), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 4, str.tostring(95), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 4, str.tostring(96), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 4, str.tostring(97), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 4, str.tostring(98), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 4, str.tostring(99), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 4, str.tostring(100), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 4, str.tostring(101), text_color=txtColor, bgcolor=bg)
table.cell(t, 15, 4, str.tostring(146), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 4, str.tostring(199), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 4, str.tostring(260), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 4, str.tostring(329), text_color=txtColor, bgcolor = bgDefault)

//c5
table.cell(t, 0, 5, str.tostring(302), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 5, str.tostring(237), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 5, str.tostring(180), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 5, str.tostring(131), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 5, str.tostring(90), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 5, str.tostring(57), text_color=txtColor, bgcolor=bg)
table.cell(t, 6, 5, str.tostring(58), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 5, str.tostring(59), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 5, str.tostring(60), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 5, str.tostring(61), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 5, str.tostring(62), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 5, str.tostring(63), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 5, str.tostring(64), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 5, str.tostring(65), text_color=txtColor, bgcolor=bg)
table.cell(t, 14, 5, str.tostring(102), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 5, str.tostring(147), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 5, str.tostring(200), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 5, str.tostring(261), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 5, str.tostring(330), text_color=txtColor, bgcolor = bgDefault)

//c6
table.cell(t, 0, 6, str.tostring(301), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 6, str.tostring(236), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 6, str.tostring(179), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 6, str.tostring(130), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 6, str.tostring(89), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 6, str.tostring(56), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 6, str.tostring(31), text_color=txtColor, bgcolor=bg)
table.cell(t, 7, 6, str.tostring(32), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 6, str.tostring(33), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 6, str.tostring(34), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 6, str.tostring(35), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 6, str.tostring(36), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 6, str.tostring(37), text_color=txtColor, bgcolor=bg)
table.cell(t, 13, 6, str.tostring(66), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 6, str.tostring(103), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 6, str.tostring(148), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 6, str.tostring(201), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 6, str.tostring(262), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 6, str.tostring(331), text_color=txtColor, bgcolor = bgDefault)


//c7
table.cell(t, 0, 7, str.tostring(300), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 7, str.tostring(235), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 7, str.tostring(178), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 7, str.tostring(129), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 7, str.tostring(88), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 7, str.tostring(55), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 7, str.tostring(30), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 7, str.tostring(13), text_color=txtColor, bgcolor=bg)
table.cell(t, 8, 7, str.tostring(14), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 7, str.tostring(15), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 7, str.tostring(16), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 7, str.tostring(17), text_color=txtColor, bgcolor=bg)
table.cell(t, 12, 7, str.tostring(38), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 7, str.tostring(67), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 7, str.tostring(104), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 7, str.tostring(149), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 7, str.tostring(202), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 7, str.tostring(263), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 7, str.tostring(332), text_color=txtColor, bgcolor = bgDefault)

//c8
table.cell(t, 0, 8, str.tostring(299), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 8, str.tostring(234), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 8, str.tostring(177), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 8, str.tostring(128), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 8, str.tostring(87), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 8, str.tostring(54), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 8, str.tostring(29), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 8, str.tostring(12), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 8, str.tostring(3), text_color=txtColor, bgcolor=bg)
table.cell(t, 9, 8, str.tostring(4), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 8, str.tostring(5), text_color=txtColor, bgcolor=bg)
table.cell(t, 11, 8, str.tostring(18), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 8, str.tostring(39), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 8, str.tostring(68), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 8, str.tostring(105), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 8, str.tostring(150), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 8, str.tostring(203), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 8, str.tostring(264), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 8, str.tostring(333), text_color=txtColor, bgcolor = bgDefault)

//c9
table.cell(t, 0, 9, str.tostring(298), text_color=txtColor, bgcolor=bg)
table.cell(t, 1, 9, str.tostring(233), text_color=txtColor, bgcolor=bg)
table.cell(t, 2, 9, str.tostring(176), text_color=txtColor, bgcolor=bg)
table.cell(t, 3, 9, str.tostring(127), text_color=txtColor, bgcolor=bg)
table.cell(t, 4, 9, str.tostring(86), text_color=txtColor, bgcolor=bg)
table.cell(t, 5, 9, str.tostring(53), text_color=txtColor, bgcolor=bg)
table.cell(t, 6, 9, str.tostring(28), text_color=txtColor, bgcolor=bg)
table.cell(t, 7, 9, str.tostring(11), text_color=txtColor, bgcolor=bg)
table.cell(t, 8, 9, str.tostring(2), text_color=txtColor, bgcolor=bg)
table.cell(t, 9, 9, str.tostring(1), text_color=txtColor, bgcolor=bgDefault)  //core of sqaure=1
table.cell(t, 10, 9, str.tostring(6), text_color=txtColor, bgcolor=bg)
table.cell(t, 11, 9, str.tostring(19), text_color=txtColor, bgcolor=bg)
table.cell(t, 12, 9, str.tostring(40), text_color=txtColor, bgcolor=bg)
table.cell(t, 13, 9, str.tostring(69), text_color=txtColor, bgcolor=bg)
table.cell(t, 14, 9, str.tostring(106), text_color=txtColor, bgcolor=bg)
table.cell(t, 15, 9, str.tostring(151), text_color=txtColor, bgcolor=bg)
table.cell(t, 16, 9, str.tostring(204), text_color=txtColor, bgcolor=bg)
table.cell(t, 17, 9, str.tostring(265), text_color=txtColor, bgcolor=bg)
table.cell(t, 18, 9, str.tostring(334), text_color=txtColor, bgcolor=bg)

//c10
table.cell(t, 0, 10, str.tostring(297), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 10, str.tostring(232), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 10, str.tostring(175), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 10, str.tostring(126), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 10, str.tostring(85), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 10, str.tostring(52), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 10, str.tostring(27), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 10, str.tostring(10), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 10, str.tostring(9), text_color=txtColor, bgcolor=bg)
table.cell(t, 9, 10, str.tostring(8), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 10, str.tostring(7), text_color=txtColor, bgcolor=bg)
table.cell(t, 11, 10, str.tostring(20), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 10, str.tostring(41), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 10, str.tostring(70), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 10, str.tostring(107), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 10, str.tostring(152), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 10, str.tostring(205), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 10, str.tostring(266), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 10, str.tostring(335), text_color=txtColor, bgcolor = bgDefault)


//c11
table.cell(t, 0, 11, str.tostring(296), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 11, str.tostring(231), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 11, str.tostring(174), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 11, str.tostring(125), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 11, str.tostring(84), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 11, str.tostring(51), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 11, str.tostring(26), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 11, str.tostring(25), text_color=txtColor, bgcolor=bg)
table.cell(t, 8, 11, str.tostring(24), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 11, str.tostring(23), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 11, str.tostring(22), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 11, str.tostring(21), text_color=txtColor, bgcolor=bg)
table.cell(t, 12, 11, str.tostring(42), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 11, str.tostring(71), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 11, str.tostring(108), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 11, str.tostring(153), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 11, str.tostring(206), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 11, str.tostring(267), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 11, str.tostring(336), text_color=txtColor, bgcolor = bgDefault)


//c12
table.cell(t, 0, 12, str.tostring(295), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 12, str.tostring(230), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 12, str.tostring(173), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 12, str.tostring(124), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 12, str.tostring(83), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 12, str.tostring(50), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 12, str.tostring(49), text_color=txtColor, bgcolor=bg)
table.cell(t, 7, 12, str.tostring(48), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 12, str.tostring(47), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 12, str.tostring(46), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 12, str.tostring(45), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 12, str.tostring(44), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 12, str.tostring(43), text_color=txtColor, bgcolor=bg)
table.cell(t, 13, 12, str.tostring(72), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 12, str.tostring(109), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 12, str.tostring(154), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 12, str.tostring(207), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 12, str.tostring(268), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 12, str.tostring(337), text_color=txtColor, bgcolor = bgDefault)


//c13
table.cell(t, 0, 13, str.tostring(294), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 13, str.tostring(229), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 13, str.tostring(172), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 13, str.tostring(123), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 13, str.tostring(82), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 13, str.tostring(81), text_color=txtColor, bgcolor=bg)
table.cell(t, 6, 13, str.tostring(80), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 13, str.tostring(79), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 13, str.tostring(78), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 13, str.tostring(77), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 13, str.tostring(76), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 13, str.tostring(75), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 13, str.tostring(74), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 13, str.tostring(73), text_color=txtColor, bgcolor=bg)
table.cell(t, 14, 13, str.tostring(110), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 13, str.tostring(155), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 13, str.tostring(208), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 13, str.tostring(269), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 13, str.tostring(338), text_color=txtColor, bgcolor = bgDefault)


//c14
table.cell(t, 0, 14, str.tostring(293), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 14, str.tostring(228), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 14, str.tostring(171), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 14, str.tostring(122), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 14, str.tostring(121), text_color=txtColor, bgcolor=bg)
table.cell(t, 5, 14, str.tostring(120), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 14, str.tostring(119), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 14, str.tostring(118), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 14, str.tostring(117), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 14, str.tostring(116), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 14, str.tostring(115), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 14, str.tostring(114), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 14, str.tostring(113), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 14, str.tostring(112), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 14, str.tostring(111), text_color=txtColor, bgcolor=bg)
table.cell(t, 15, 14, str.tostring(156), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 14, str.tostring(209), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 14, str.tostring(270), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 14, str.tostring(339), text_color=txtColor, bgcolor = bgDefault)


//c15
table.cell(t, 0, 15, str.tostring(292), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 15, str.tostring(227), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 15, str.tostring(170), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 15, str.tostring(169), text_color=txtColor, bgcolor=bg)
table.cell(t, 4, 15, str.tostring(168), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 15, str.tostring(167), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 15, str.tostring(166), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 15, str.tostring(165), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 15, str.tostring(164), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 15, str.tostring(163), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 15, str.tostring(162), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 15, str.tostring(161), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 15, str.tostring(160), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 15, str.tostring(159), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 15, str.tostring(158), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 15, str.tostring(157), text_color=txtColor, bgcolor=bg)
table.cell(t, 16, 15, str.tostring(210), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 15, str.tostring(271), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 15, str.tostring(340), text_color=txtColor, bgcolor = bgDefault)


//c16
table.cell(t, 0, 16, str.tostring(291), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 16, str.tostring(226), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 16, str.tostring(225), text_color=txtColor, bgcolor=bg)
table.cell(t, 3, 16, str.tostring(224), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 16, str.tostring(223), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 16, str.tostring(222), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 16, str.tostring(221), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 16, str.tostring(220), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 16, str.tostring(219), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 16, str.tostring(218), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 16, str.tostring(217), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 16, str.tostring(216), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 16, str.tostring(215), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 16, str.tostring(214), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 16, str.tostring(213), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 16, str.tostring(212), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 16, str.tostring(211), text_color=txtColor, bgcolor=bg)
table.cell(t, 17, 16, str.tostring(272), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 16, str.tostring(341), text_color=txtColor, bgcolor = bgDefault)


//c17
table.cell(t, 0, 17, str.tostring(290), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 1, 17, str.tostring(289), text_color=txtColor, bgcolor=bg)
table.cell(t, 2, 17, str.tostring(288), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 17, str.tostring(287), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 17, str.tostring(286), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 17, str.tostring(285), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 17, str.tostring(284), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 17, str.tostring(283), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 17, str.tostring(282), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 17, str.tostring(281), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 17, str.tostring(280), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 17, str.tostring(279), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 17, str.tostring(278), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 17, str.tostring(277), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 17, str.tostring(276), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 17, str.tostring(275), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 17, str.tostring(274), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 17, str.tostring(273), text_color=txtColor, bgcolor=bg)
table.cell(t, 18, 17, str.tostring(342), text_color=txtColor, bgcolor = bgDefault)


//c18
table.cell(t, 0, 18, str.tostring(361), text_color=txtColor, bgcolor=bg)
table.cell(t, 1, 18, str.tostring(360), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 2, 18, str.tostring(359), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 3, 18, str.tostring(358), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 4, 18, str.tostring(357), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 5, 18, str.tostring(356), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 6, 18, str.tostring(355), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 7, 18, str.tostring(354), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 8, 18, str.tostring(353), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 9, 18, str.tostring(352), text_color=txtColor, bgcolor=bg)
table.cell(t, 10, 18, str.tostring(351), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 11, 18, str.tostring(350), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 12, 18, str.tostring(349), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 13, 18, str.tostring(348), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 14, 18, str.tostring(347), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 15, 18, str.tostring(346), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 16, 18, str.tostring(345), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 17, 18, str.tostring(344), text_color=txtColor, bgcolor = bgDefault)
table.cell(t, 18, 18, str.tostring(343), text_color=txtColor, bgcolor=bg)

//get date info
lastDate = input.time(title='Date : ', defval=timestamp('1 sep 2022'), tooltip='Last HH or LL Date ')

//get numbers
firstPivot = input.int(title='Num 1 : ', defval=0, tooltip='First number to show future pivot', group="Numbers")
SecondPivot = input.int(title='Num 2 : ', defval=0, tooltip='Second number to show future pivot', group="Numbers")
ThirdPivot = input.int(title='Num 3 : ', defval=0, tooltip='Third number to show future pivot', group="Numbers")
fourthPivot = input.int(title='Num 4 : ', defval=0, tooltip='Fourth number to show future pivot', group="Numbers")
fifthPivot = input.int(title='Num 5 : ', defval=0, tooltip='Fifth number to show future pivot', group="Numbers")
sixthPivot = input.int(title='Num 6 : ', defval=0, tooltip='sixth number to show future pivot', group="Numbers")
seventhPivot = input.int(title='Num 7 : ', defval=0, tooltip='seventh number to show future pivot', group="Numbers")

//get labels color
firstColor = input.color(title='Num 1 Color: ', defval=color.blue, tooltip='First number color label', group="Colors")
secondColor = input.color(title='Num 2 Color: ', defval=color.blue, tooltip='Second number color label', group="Colors")
thirdColor = input.color(title='Num 3 Color: ', defval=color.blue, tooltip='Third number color label', group="Colors")
fourthColor = input.color(title='Num 4 Color: ', defval=color.blue, tooltip='Fourth number color label', group="Colors")
fifthColor = input.color(title='Num 5 Color: ', defval=color.blue, tooltip='Fifth number color label', group="Colors")
sixthColor = input.color(title='Num 6 Color: ', defval=color.blue, tooltip='sixth number color label', group="Colors")
seventhColor = input.color(title='Num 7 Color: ', defval=color.blue, tooltip='seventh number color label', group="Colors")



if firstPivot != 0
    d1 = line.new(lastDate + firstPivot * 86400000, high, lastDate + firstPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l1 = label.new(lastDate + firstPivot * 86400000, low, str.tostring(firstPivot), xloc=xloc.bar_time, color=firstColor)
    label.delete(l1[1])
    line.delete(d1[1])

if SecondPivot != 0
    d2 = line.new(lastDate + SecondPivot * 86400000, high, lastDate + SecondPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l2 = label.new(lastDate + SecondPivot * 86400000, low, str.tostring(SecondPivot), xloc=xloc.bar_time, color=secondColor)
    label.delete(l2[1])
    line.delete(d2[1])

if ThirdPivot != 0
    d3 = line.new(lastDate + ThirdPivot * 86400000, high, lastDate + ThirdPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l3 = label.new(lastDate + ThirdPivot * 86400000, low, str.tostring(ThirdPivot), xloc=xloc.bar_time, color=thirdColor)
    label.delete(l3[1])
    line.delete(d3[1])

if fourthPivot != 0
    d4 = line.new(lastDate + fourthPivot * 86400000, high, lastDate + fourthPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l4 = label.new(lastDate + fourthPivot * 86400000, low, str.tostring(fourthPivot), xloc=xloc.bar_time, color=fourthColor)
    label.delete(l4[1])
    line.delete(d4[1])

if fifthPivot != 0
    d5 = line.new(lastDate + fifthPivot * 86400000, high, lastDate + fifthPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l5 = label.new(lastDate + fifthPivot * 86400000, low, str.tostring(fifthPivot), xloc=xloc.bar_time, color=fifthColor)
    label.delete(l5[1])
    line.delete(d5[1])

if sixthPivot != 0
    d6 = line.new(lastDate + sixthPivot * 86400000, high, lastDate + sixthPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l6 = label.new(lastDate + sixthPivot * 86400000, low, str.tostring(sixthPivot), xloc=xloc.bar_time, color=sixthColor)
    label.delete(l6[1])
    line.delete(d6[1])

if seventhPivot != 0
    d7 = line.new(lastDate + seventhPivot * 86400000, high, lastDate + seventhPivot * 86400000, high - 1, xloc=xloc.bar_time, extend=extend.both, color=color.orange, style=line.style_dashed)
    l7 = label.new(lastDate + seventhPivot * 86400000, low, str.tostring(seventhPivot), xloc=xloc.bar_time, color=seventhColor)
    label.delete(l7[1])
    line.delete(d7[1])

