Intraday Background Time Ranges
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © valpatrad

//@version=5
indicator('Intraday Background Time Ranges', 'Time Ranges', true)


if not timeframe.isintraday
    runtime.error('The indicator works on intraday charts only.')



////////////////////////////
//                        //
//          Menu          //
//                        //
////////////////////////////

ant = input.bool(true, 'Anticipate')

	//Range 1
show_1 = input.bool(true, '  1', inline='1.1')
col_1 = input.color(color.new(#2962FF, 90), '', inline='1.1')
note_1 = input.string('', '    -  Table ', inline='1.1')
txt_col_1 = input.color(#FFFFFF, '', inline='1.1', tooltip='Leave the text field empty to remove the table slot.')
start_hour_1 = input.int(9, '', 0, 24, inline='1.2')
start_min_1 = input.int(30, '-', 0, 59, inline='1.2')
end_hour_1 = input.int(9, '/', 0, 24, inline='1.2')
end_min_1 = input.int(43, '-', 0, 59, inline='1.2', tooltip='Starting Time: Hour - Minutes / Ending Time: Hour - Minutes')

	//Range 2
show_2 = input.bool(true, '  2', inline='2.1')
col_2 = input.color(color.new(#FFFFFF, 90), '', inline='2.1')
note_2 = input.string('', '    -  Table ', inline='2.1')
txt_col_2 = input.color(#000000, '', inline='2.1')
start_hour_2 = input.int(9, '', 0, 24, inline='2.2')
start_min_2 = input.int(43, '-', 0, 59, inline='2.2')
end_hour_2 = input.int(9, '/', 0, 24, inline='2.2')
end_min_2 = input.int(56, '-', 0, 59, inline='2.2')

	//Range 3
show_3 = input.bool(true, '  3', inline='3.1')
col_3 = input.color(color.new(#880E4F, 90), '', inline='3.1')
note_3 = input.string('', '    -  Table ', inline='3.1')
txt_col_3 = input.color(#FFFFFF, '', inline='3.1')
start_hour_3 = input.int(9, '', 0, 24, inline='3.2')
start_min_3 = input.int(56, '-', 0, 59, inline='3.2')
end_hour_3 = input.int(10, '/', 0, 24, inline='3.2')
end_min_3 = input.int(9, '-', 0, 59, inline='3.2')

	//Range 4
show_4 = input.bool(true, '  4', inline='4.1')
col_4 = input.color(color.new(#00BCD4, 90), '', inline='4.1')
note_4 = input.string('', '    -  Table ', inline='4.1')
txt_col_4 = input.color(#000000, '', inline='4.1')
start_hour_4 = input.int(10, '', 0, 24, inline='4.2')
start_min_4 = input.int(9, '-', 0, 59, inline='4.2')
end_hour_4 = input.int(10, '/', 0, 24, inline='4.2')
end_min_4 = input.int(22, '-', 0, 59, inline='4.2')

	//Range 5
show_5 = input.bool(true, '  5', inline='5.1')
col_5 = input.color(color.new(#FFEB3B, 90), '', inline='5.1')
note_5 = input.string('', '    -  Table ', inline='5.1')
txt_col_5 = input.color(#000000, '', inline='5.1')
start_hour_5 = input.int(10, '', 0, 24, inline='5.2')
start_min_5 = input.int(22, '-', 0, 59, inline='5.2')
end_hour_5 = input.int(10, '/', 0, 24, inline='5.2')
end_min_5 = input.int(35, '-', 0, 59, inline='5.2')

	//Range 6
show_6 = input.bool(true, '  6', inline='6.1')
col_6 = input.color(color.new(#FF5252, 90), '', inline='6.1')
note_6 = input.string('', '    -  Table ', inline='6.1')
txt_col_6 = input.color(#000000, '', inline='6.1')
start_hour_6 = input.int(10, '', 0, 24, inline='6.2')
start_min_6 = input.int(35, '-', 0, 59, inline='6.2')
end_hour_6 = input.int(10, '/', 0, 24, inline='6.2')
end_min_6 = input.int(48, '-', 0, 59, inline='6.2')

	//Range 7
show_7 = input.bool(false, '  7', inline='7.1')
col_7 = input.color(color.new(#81C784, 90), '', inline='7.1')
note_7 = input.string('', '    -  Table ', inline='7.1')
txt_col_7 = input.color(#000000, '', inline='7.1')
start_hour_7 = input.int(10, '', 0, 24, inline='7.2')
start_min_7 = input.int(48, '-', 0, 59, inline='7.2')
end_hour_7 = input.int(11, '/', 0, 24, inline='7.2')
end_min_7 = input.int(1, '-', 0, 59, inline='7.2')

	//Range 8
show_8 = input.bool(false, '  8', inline='8.1')
col_8 = input.color(color.new(#CE93D8, 90), '', inline='8.1')
note_8 = input.string('', '    -  Table ', inline='8.1')
txt_col_8 = input.color(#000000, '', inline='8.1')
start_hour_8 = input.int(11, '', 0, 24, inline='8.2')
start_min_8 = input.int(1, '-', 0, 59, inline='8.2')
end_hour_8 = input.int(11, '/', 0, 24, inline='8.2')
end_min_8 = input.int(14, '-', 0, 59, inline='8.2')

	//Range 9
show_9 = input.bool(false, '  9', inline='9.1')
col_9 = input.color(color.new(#808000, 90), '', inline='9.1')
note_9 = input.string('', '    -  Table ', inline='9.1')
txt_col_9 = input.color(#FFFFFF, '', inline='9.1')
start_hour_9 = input.int(11, '', 0, 24, inline='9.2')
start_min_9 = input.int(14, '-', 0, 59, inline='9.2')
end_hour_9 = input.int(11, '/', 0, 24, inline='9.2')
end_min_9 = input.int(27, '-', 0, 59, inline='9.2')

	//Range 10
show_10 = input.bool(false, '10', inline='10.1')
col_10 = input.color(color.new(#9C27B0, 90), '', inline='10.1')
note_10 = input.string('', '    -  Table ', inline='10.1')
txt_col_10 = input.color(#FFFFFF, '', inline='10.1')
start_hour_10 = input.int(11, '', 0, 24, inline='10.2')
start_min_10 = input.int(27, '-', 0, 59, inline='10.2')
end_hour_10 = input.int(11, '/', 0, 24, inline='10.2')
end_min_10 = input.int(40, '-', 0, 59, inline='10.2')

	//Range 11
show_11 = input.bool(false, '11', inline='11.1')
col_11 = input.color(color.new(#00FF0C, 90), '', inline='11.1')
note_11 = input.string('', '    -  Table ', inline='11.1')
txt_col_11 = input.color(#000000, '', inline='11.1')
start_hour_11 = input.int(11, '', 0, 24, inline='11.2')
start_min_11 = input.int(40, '-', 0, 59, inline='11.2')
end_hour_11 = input.int(11, '/', 0, 24, inline='11.2')
end_min_11 = input.int(53, '-', 0, 59, inline='11.2')

	//Range 12
show_12 = input.bool(false, '12', inline='12.1')
col_12 = input.color(color.new(#F57F17, 90), '', inline='12.1')
note_12 = input.string('', '    -  Table ', inline='12.1')
txt_col_12 = input.color(#000000, '', inline='12.1')
start_hour_12 = input.int(11, '', 0, 24, inline='12.2')
start_min_12 = input.int(53, '-', 0, 59, inline='12.2')
end_hour_12 = input.int(12, '/', 0, 24, inline='12.2')
end_min_12 = input.int(6, '-', 0, 59, inline='12.2')

	//Range 13
show_13 = input.bool(false, '13', inline='13.1')
col_13 = input.color(color.new(#006064, 90), '', inline='13.1')
note_13 = input.string('', '    -  Table ', inline='13.1')
txt_col_13 = input.color(#FFFFFF, '', inline='13.1')
start_hour_13 = input.int(12, '', 0, 24, inline='13.2')
start_min_13 = input.int(6, '-', 0, 59, inline='13.2')
end_hour_13 = input.int(12, '/', 0, 24, inline='13.2')
end_min_13 = input.int(19, '-', 0, 59, inline='13.2')

	//Range 14
show_14 = input.bool(false, '14', inline='14.1')
col_14 = input.color(color.new(#FF1493, 90), '', inline='14.1')
note_14 = input.string('', '    -  Table ', inline='14.1')
txt_col_14 = input.color(#FFFFFF, '', inline='14.1')
start_hour_14 = input.int(12, '', 0, 24, inline='14.2')
start_min_14 = input.int(19, '-', 0, 59, inline='14.2')
end_hour_14 = input.int(12, '/', 0, 24, inline='14.2')
end_min_14 = input.int(32, '-', 0, 59, inline='14.2')

	//Range 15
show_15 = input.bool(false, '15', inline='15.1')
col_15 = input.color(color.new(#00FFFF, 90), '', inline='15.1')
note_15 = input.string('', '    -  Table ', inline='15.1')
txt_col_15 = input.color(#FFFFFF, '', inline='15.1')
start_hour_15 = input.int(12, '', 0, 24, inline='15.2')
start_min_15 = input.int(32, '-', 0, 59, inline='15.2')
end_hour_15 = input.int(12, '/', 0, 24, inline='15.2')
end_min_15 = input.int(45, '-', 0, 59, inline='15.2')

	//Range 16
show_16 = input.bool(false, '16', inline='16.1')
col_16 = input.color(color.new(#FF8C00, 90), '', inline='16.1')
note_16 = input.string('', '    -  Table ', inline='16.1')
txt_col_16 = input.color(#FFFFFF, '', inline='16.1')
start_hour_16 = input.int(12, '', 0, 24, inline='16.2')
start_min_16 = input.int(45, '-', 0, 59, inline='16.2')
end_hour_16 = input.int(12, '/', 0, 24, inline='16.2')
end_min_16 = input.int(58, '-', 0, 59, inline='16.2')

	//Range 17
show_17 = input.bool(false, '17', inline='17.1')
col_17 = input.color(color.new(#7B68EE, 90), '', inline='17.1')
note_17 = input.string('', '    -  Table ', inline='17.1')
txt_col_17 = input.color(#FFFFFF, '', inline='17.1')
start_hour_17 = input.int(12, '', 0, 24, inline='17.2')
start_min_17 = input.int(58, '-', 0, 59, inline='17.2')
end_hour_17 = input.int(13, '/', 0, 24, inline='17.2')
end_min_17 = input.int(11, '-', 0, 59, inline='17.2')

	//Range 18
show_18 = input.bool(false, '18', inline='18.1')
col_18 = input.color(color.new(#32CD32, 90), '', inline='18.1')
note_18 = input.string('', '    -  Table ', inline='18.1')
txt_col_18 = input.color(#FFFFFF, '', inline='18.1')
start_hour_18 = input.int(13, '', 0, 24, inline='18.2')
start_min_18 = input.int(11, '-', 0, 59, inline='18.2')
end_hour_18 = input.int(13, '/', 0, 24, inline='18.2')
end_min_18 = input.int(24, '-', 0, 59, inline='18.2')

	//Range 19
show_19 = input.bool(false, '19', inline='19.1')
col_19 = input.color(color.new(#9370DB, 90), '', inline='19.1')
note_19 = input.string('', '    -  Table ', inline='19.1')
txt_col_19 = input.color(#FFFFFF, '', inline='19.1')
start_hour_19 = input.int(13, '', 0, 24, inline='19.2')
start_min_19 = input.int(24, '-', 0, 59, inline='19.2')
end_hour_19 = input.int(13, '/', 0, 24, inline='19.2')
end_min_19 = input.int(37, '-', 0, 59, inline='19.2')

	//Range 20
show_20 = input.bool(false, '20', inline='20.1')
col_20 = input.color(color.new(#FFD700, 90), '', inline='20.1')
note_20 = input.string('', '    -  Table ', inline='20.1')
txt_col_20 = input.color(#FFFFFF, '', inline='20.1')
start_hour_20 = input.int(13, '', 0, 24, inline='20.2')
start_min_20 = input.int(37, '-', 0, 59, inline='20.2')
end_hour_20 = input.int(13, '/', 0, 24, inline='20.2')
end_min_20 = input.int(50, '-', 0, 59, inline='20.2')

	//Range 21
show_21 = input.bool(false, '21', inline='21.1')
col_21 = input.color(color.new(#3CB371, 90), '', inline='21.1')
note_21 = input.string('', '    -  Table ', inline='21.1')
txt_col_21 = input.color(#FFFFFF, '', inline='21.1')
start_hour_21 = input.int(13, '', 0, 24, inline='21.2')
start_min_21 = input.int(50, '-', 0, 59, inline='21.2')
end_hour_21 = input.int(14, '/', 0, 24, inline='21.2')
end_min_21 = input.int(3, '-', 0, 59, inline='21.2')

	//Range 22
show_22 = input.bool(false, '22', inline='22.1')
col_22 = input.color(color.new(#BA55D3, 90), '', inline='22.1')
note_22 = input.string('', '    -  Table ', inline='22.1')
txt_col_22 = input.color(#FFFFFF, '', inline='22.1')
start_hour_22 = input.int(14, '', 0, 24, inline='22.2')
start_min_22 = input.int(3, '-', 0, 59, inline='22.2')
end_hour_22 = input.int(14, '/', 0, 24, inline='22.2')
end_min_22 = input.int(16, '-', 0, 59, inline='22.2')

	//Range 23
show_23 = input.bool(false, '23', inline='23.1')
col_23 = input.color(color.new(#FFA500, 90), '', inline='23.1')
note_23 = input.string('', '    -  Table ', inline='23.1')
txt_col_23 = input.color(#FFFFFF, '', inline='23.1')
start_hour_23 = input.int(14, '', 0, 24, inline='23.2')
start_min_23 = input.int(16, '-', 0, 59, inline='23.2')
end_hour_23 = input.int(14, '/', 0, 24, inline='23.2')
end_min_23 = input.int(29, '-', 0, 59, inline='23.2')

	//Range 24
show_24 = input.bool(false, '24', inline='24.1')
col_24 = input.color(color.new(#66CDAA, 90), '', inline='24.1')
note_24 = input.string('', '    -  Table ', inline='24.1')
txt_col_24 = input.color(#FFFFFF, '', inline='24.1')
start_hour_24 = input.int(14, '', 0, 24, inline='24.2')
start_min_24 = input.int(29, '-', 0, 59, inline='24.2')
end_hour_24 = input.int(14, '/', 0, 24, inline='24.2')
end_min_24 = input.int(42, '-', 0, 59, inline='24.2')

	//Range 25
show_25 = input.bool(false, '25', inline='25.1')
col_25 = input.color(color.new(#8B4513, 90), '', inline='25.1')
note_25 = input.string('', '    -  Table ', inline='25.1')
txt_col_25 = input.color(#FFFFFF, '', inline='25.1')
start_hour_25 = input.int(14, '', 0, 24, inline='25.2')
start_min_25 = input.int(42, '-', 0, 59, inline='25.2')
end_hour_25 = input.int(14, '/', 0, 24, inline='25.2')
end_min_25 = input.int(55, '-', 0, 59, inline='25.2')

	//Range 26
show_26 = input.bool(false, '26', inline='26.1')
col_26 = input.color(color.new(#FF69B4, 90), '', inline='26.1')
note_26 = input.string('', '    -  Table ', inline='26.1')
txt_col_26 = input.color(#FFFFFF, '', inline='26.1')
start_hour_26 = input.int(14, '', 0, 24, inline='26.2')
start_min_26 = input.int(55, '-', 0, 59, inline='26.2')
end_hour_26 = input.int(15, '/', 0, 24, inline='26.2')
end_min_26 = input.int(8, '-', 0, 59, inline='26.2')

	//Range 27
show_27 = input.bool(false, '27', inline='27.1')
col_27 = input.color(color.new(#1E90FF, 90), '', inline='27.1')
note_27 = input.string('', '    -  Table ', inline='27.1')
txt_col_27 = input.color(#FFFFFF, '', inline='27.1')
start_hour_27 = input.int(15, '', 0, 24, inline='27.2')
start_min_27 = input.int(8, '-', 0, 59, inline='27.2')
end_hour_27 = input.int(15, '/', 0, 24, inline='27.2')
end_min_27 = input.int(21, '-', 0, 59, inline='27.2')

	//Range 28
show_28 = input.bool(false, '28', inline='28.1')
col_28 = input.color(color.new(#FFDAB9, 90), '', inline='28.1')
note_28 = input.string('', '    -  Table ', inline='28.1')
txt_col_28 = input.color(#FFFFFF, '', inline='28.1')
start_hour_28 = input.int(15, '', 0, 24, inline='28.2')
start_min_28 = input.int(21, '-', 0, 59, inline='28.2')
end_hour_28 = input.int(15, '/', 0, 24, inline='28.2')
end_min_28 = input.int(34, '-', 0, 59, inline='28.2')

	//Range 29
show_29 = input.bool(false, '29', inline='29.1')
col_29 = input.color(color.new(#8A2BE2, 90), '', inline='29.1')
note_29 = input.string('', '    -  Table ', inline='29.1')
txt_col_29 = input.color(#FFFFFF, '', inline='29.1')
start_hour_29 = input.int(15, '', 0, 24, inline='29.2')
start_min_29 = input.int(34, '-', 0, 59, inline='29.2')
end_hour_29 = input.int(15, '/', 0, 24, inline='29.2')
end_min_29 = input.int(47, '-', 0, 59, inline='29.2')

	//Range 30
show_30 = input.bool(false, '30', inline='30.1')
col_30 = input.color(color.new(#FFFF00, 90), '', inline='30.1')
note_30 = input.string('', '    -  Table ', inline='30.1')
txt_col_30 = input.color(#FFFFFF, '', inline='30.1')
start_hour_30 = input.int(15, '', 0, 24, inline='30.2')
start_min_30 = input.int(47, '-', 0, 59, inline='30.2')
end_hour_30 = input.int(16, '/', 0, 24, inline='30.2')
end_min_30 = input.int(0, '-', 0, 59, inline='30.2')

	//Table
in_font = input.string('Default', 'Text Font' , ['Default', 'Monospace'], group='Table')
font = switch in_font
	'Default' => font.family_default
	'Monospace' => font.family_monospace
show_frame = input.bool(false, 'Frame', group='Table')
col_bord = input.color(color.new(#363A45, 100), 'Border Color', group='Table')
width_bord = input.int(1, 'Border Width', 0, group='Table')
transp = input.int(20, 'Transparency', 0, 100, group='Table')
input_tab_size = input.string('Auto', 'Size', group='Table', options=['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'])
tab_size = switch input_tab_size
    'Auto'   => size.auto
    'Tiny'   => size.tiny
    'Small'  => size.small
    'Normal' => size.normal
    'Large'  => size.large
    'Huge'   => size.huge
input_tab_pos = input.string('Bottom Right', 'Position', group='Table', options=['Top Left', 'Top Center', 'Top Right', 'Middle Left', 'Middle Center', 'Middle Right', 'Bottom Left', 'Bottom Center', 'Bottom Right'])
tab_pos = switch input_tab_pos
    'Top Left' => position.top_left
	'Top Center' => position.top_center
    'Top Right' => position.top_right
	'Middle Left' => position.middle_left
	'Middle Center' => position.middle_center
	'Middle Right' => position.middle_right
    'Bottom Left'  => position.bottom_left
    'Bottom Center' => position.bottom_center
    'Bottom Right' => position.bottom_right



/////////////////////////////
//                         //
//        Variables        //
//                         //
/////////////////////////////

tdy = year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time)

_bgcond(start_hour, start_min, end_hour, end_min) =>
	start = timestamp(syminfo.timezone, year, month, dayofmonth, start_hour, start_min, 00)
	end = timestamp(syminfo.timezone, year, month, dayofmonth, end_hour, end_min, 00)
	(time >= start and time < end and ant and not tdy) or (time >= start and time < end and not ant)

_range(show, start_hour, start_min, end_hour, end_min, col) =>
	start = timestamp(syminfo.timezone, year, month, dayofmonth, start_hour, start_min, 00)
	end = timestamp(syminfo.timezone, year, month, dayofmonth, end_hour, end_min, 00)
    var line id_1 = na
	var line id_2 = na
	if ant and show
		id_1 := line.new(start, low, start, high, xloc.bar_time, extend.both, na)
		line.delete(id_1[1])
		id_2 := line.new(end, low, end, high, xloc.bar_time, extend.both, na)
		line.delete(id_2[1])
		linefill.new(id_1, id_2, col)

	//Table
tab=table.new(tab_pos, 1, 30, border_color=color.new(col_bord, transp), border_width=width_bord, frame_color=show_frame ? color.new(col_bord, transp) : na, frame_width=show_frame ? width_bord : 0)
_n(a, txt, r, txt_col, bgcol) =>
	var row = 0
	if a and txt != ''
		row := r
		table.cell(tab, 0, row, txt, text_color=txt_col, text_size=tab_size, bgcolor=color.new(bgcol, transp), text_font_family=font)



////////////////////////////
//                        //
//          Plot          //
//                        //
////////////////////////////

	//Time Ranges
bgcolor(show_1 and _bgcond(start_hour_1, start_min_1, end_hour_1, end_min_1) ? col_1 : na, editable=false)
bgcolor(show_2 and _bgcond(start_hour_2, start_min_2, end_hour_2, end_min_2) ? col_2 : na, editable=false)
bgcolor(show_3 and _bgcond(start_hour_3, start_min_3, end_hour_3, end_min_3) ? col_3 : na, editable=false)
bgcolor(show_4 and _bgcond(start_hour_4, start_min_4, end_hour_4, end_min_4) ? col_4 : na, editable=false)
bgcolor(show_5 and _bgcond(start_hour_5, start_min_5, end_hour_5, end_min_5) ? col_5 : na, editable=false)
bgcolor(show_6 and _bgcond(start_hour_6, start_min_6, end_hour_6, end_min_6) ? col_6 : na, editable=false)
bgcolor(show_7 and _bgcond(start_hour_7, start_min_7, end_hour_7, end_min_7) ? col_7 : na, editable=false)
bgcolor(show_8 and _bgcond(start_hour_8, start_min_8, end_hour_8, end_min_8) ? col_8 : na, editable=false)
bgcolor(show_9 and _bgcond(start_hour_9, start_min_9, end_hour_9, end_min_9) ? col_9 : na, editable=false)
bgcolor(show_10 and _bgcond(start_hour_10, start_min_10, end_hour_10, end_min_10) ? col_10 : na, editable=false)
bgcolor(show_11 and _bgcond(start_hour_11, start_min_11, end_hour_11, end_min_11) ? col_11 : na, editable=false)
bgcolor(show_12 and _bgcond(start_hour_12, start_min_12, end_hour_12, end_min_12) ? col_12 : na, editable=false)
bgcolor(show_13 and _bgcond(start_hour_13, start_min_13, end_hour_13, end_min_13) ? col_13 : na, editable=false)
bgcolor(show_14 and _bgcond(start_hour_14, start_min_14, end_hour_14, end_min_14) ? col_14 : na, editable=false)
bgcolor(show_15 and _bgcond(start_hour_15, start_min_15, end_hour_15, end_min_15) ? col_15 : na, editable=false)
bgcolor(show_16 and _bgcond(start_hour_16, start_min_16, end_hour_16, end_min_16) ? col_16 : na, editable=false)
bgcolor(show_17 and _bgcond(start_hour_17, start_min_17, end_hour_17, end_min_17) ? col_17 : na, editable=false)
bgcolor(show_18 and _bgcond(start_hour_18, start_min_18, end_hour_18, end_min_18) ? col_18 : na, editable=false)
bgcolor(show_19 and _bgcond(start_hour_19, start_min_19, end_hour_19, end_min_19) ? col_19 : na, editable=false)
bgcolor(show_20 and _bgcond(start_hour_20, start_min_20, end_hour_20, end_min_20) ? col_20 : na, editable=false)
bgcolor(show_21 and _bgcond(start_hour_21, start_min_21, end_hour_21, end_min_21) ? col_21 : na, editable=false)
bgcolor(show_22 and _bgcond(start_hour_22, start_min_22, end_hour_22, end_min_22) ? col_22 : na, editable=false)
bgcolor(show_23 and _bgcond(start_hour_23, start_min_23, end_hour_23, end_min_23) ? col_23 : na, editable=false)
bgcolor(show_24 and _bgcond(start_hour_24, start_min_24, end_hour_24, end_min_24) ? col_24 : na, editable=false)
bgcolor(show_25 and _bgcond(start_hour_25, start_min_25, end_hour_25, end_min_25) ? col_25 : na, editable=false)
bgcolor(show_26 and _bgcond(start_hour_26, start_min_26, end_hour_26, end_min_26) ? col_26 : na, editable=false)
bgcolor(show_27 and _bgcond(start_hour_27, start_min_27, end_hour_27, end_min_27) ? col_27 : na, editable=false)
bgcolor(show_28 and _bgcond(start_hour_28, start_min_28, end_hour_28, end_min_28) ? col_28 : na, editable=false)
bgcolor(show_29 and _bgcond(start_hour_29, start_min_29, end_hour_29, end_min_29) ? col_29 : na, editable=false)
bgcolor(show_30 and _bgcond(start_hour_30, start_min_30, end_hour_30, end_min_30) ? col_30 : na, editable=false)

	//Anticipate
_range(show_1, start_hour_1, start_min_1, end_hour_1, end_min_1, col_1)
_range(show_2, start_hour_2, start_min_2, end_hour_2, end_min_2, col_2)
_range(show_3, start_hour_3, start_min_3, end_hour_3, end_min_3, col_3)
_range(show_4, start_hour_4, start_min_4, end_hour_4, end_min_4, col_4)
_range(show_5, start_hour_5, start_min_5, end_hour_5, end_min_5, col_5)
_range(show_6, start_hour_6, start_min_6, end_hour_6, end_min_6, col_6)
_range(show_7, start_hour_7, start_min_7, end_hour_7, end_min_7, col_7)
_range(show_8, start_hour_8, start_min_8, end_hour_8, end_min_8, col_8)
_range(show_9, start_hour_9, start_min_9, end_hour_9, end_min_9, col_9)
_range(show_10, start_hour_10, start_min_10, end_hour_10, end_min_10, col_10)
_range(show_11, start_hour_11, start_min_11, end_hour_11, end_min_11, col_11)
_range(show_12, start_hour_12, start_min_12, end_hour_12, end_min_12, col_12)
_range(show_13, start_hour_13, start_min_13, end_hour_13, end_min_13, col_13)
_range(show_14, start_hour_14, start_min_14, end_hour_14, end_min_14, col_14)
_range(show_15, start_hour_15, start_min_15, end_hour_15, end_min_15, col_15)
_range(show_16, start_hour_16, start_min_16, end_hour_16, end_min_16, col_16)
_range(show_17, start_hour_17, start_min_17, end_hour_17, end_min_17, col_17)
_range(show_18, start_hour_18, start_min_18, end_hour_18, end_min_18, col_18)
_range(show_19, start_hour_19, start_min_19, end_hour_19, end_min_19, col_19)
_range(show_20, start_hour_20, start_min_20, end_hour_20, end_min_20, col_20)
_range(show_21, start_hour_21, start_min_21, end_hour_21, end_min_21, col_21)
_range(show_22, start_hour_22, start_min_22, end_hour_22, end_min_22, col_22)
_range(show_23, start_hour_23, start_min_23, end_hour_23, end_min_23, col_23)
_range(show_24, start_hour_24, start_min_24, end_hour_24, end_min_24, col_24)
_range(show_25, start_hour_25, start_min_25, end_hour_25, end_min_25, col_25)
_range(show_26, start_hour_26, start_min_26, end_hour_26, end_min_26, col_26)
_range(show_27, start_hour_27, start_min_27, end_hour_27, end_min_27, col_27)
_range(show_28, start_hour_28, start_min_28, end_hour_28, end_min_28, col_28)
_range(show_29, start_hour_29, start_min_29, end_hour_29, end_min_29, col_29)
_range(show_30, start_hour_30, start_min_30, end_hour_30, end_min_30, col_30)

	//Table
_n(show_1, note_1, 0, txt_col_1, col_1)
_n(show_2, note_2, 1, txt_col_2, col_2)
_n(show_3, note_3, 2, txt_col_3, col_3)
_n(show_4, note_4, 3, txt_col_4, col_4)
_n(show_5, note_5, 4, txt_col_5, col_5)
_n(show_6, note_6, 5, txt_col_6, col_6)
_n(show_7, note_7, 6, txt_col_7, col_7)
_n(show_8, note_8, 7, txt_col_8, col_8)
_n(show_9, note_9, 8, txt_col_9, col_9)
_n(show_10, note_10, 9, txt_col_10, col_10)
_n(show_11, note_11, 10, txt_col_11, col_11)
_n(show_12, note_12, 11, txt_col_12, col_12)
_n(show_13, note_13, 12, txt_col_13, col_13)
_n(show_14, note_14, 13, txt_col_14, col_14)
_n(show_15, note_15, 14, txt_col_15, col_15)
_n(show_16, note_16, 15, txt_col_16, col_16)
_n(show_17, note_17, 16, txt_col_17, col_17)
_n(show_18, note_18, 17, txt_col_18, col_18)
_n(show_19, note_19, 18, txt_col_19, col_19)
_n(show_20, note_20, 29, txt_col_20, col_20)
_n(show_21, note_21, 20, txt_col_21, col_21)
_n(show_22, note_22, 21, txt_col_22, col_22)
_n(show_23, note_23, 22, txt_col_23, col_23)
_n(show_24, note_24, 23, txt_col_24, col_24)
_n(show_25, note_25, 24, txt_col_25, col_25)
_n(show_26, note_26, 25, txt_col_26, col_26)
_n(show_27, note_27, 26, txt_col_27, col_27)
_n(show_28, note_28, 27, txt_col_28, col_28)
_n(show_29, note_29, 28, txt_col_29, col_29)
_n(show_30, note_30, 29, txt_col_30, col_30)