Trading Checklist
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FX365_Thailand

//Revision history
//v53.0 First release
//v54.0 Fixed text size adjustment
//v55.0 Improved criteria fields for easier text input


//@version=5
indicator("Trading Checklist",shorttitle = "Trading Checklist", overlay = true)

//User input
cr1 = input.text_area(title="Criteria 1", defval="Enter your criteria here",group="Criteria", tooltip="If you do not need a criterion, then delete it. It will not be shown on the table.")
cr2 = input.text_area(title="Criteria 2", defval="Enter your criteria here")
cr3 = input.text_area(title="Criteria 3", defval="Enter your criteria here")
cr4 = input.text_area(title="Criteria 4", defval="Enter your criteria here")
cr5 = input.text_area(title="Criteria 5", defval="Enter your criteria here")
cr6 = input.text_area(title="Criteria 6", defval="Enter your criteria here")
cr7 = input.text_area(title="Criteria 7", defval="Enter your criteria here")
cr8 = input.text_area(title="Criteria 8", defval="Enter your criteria here")
cr9 = input.text_area(title="Criteria 9", defval="Enter your criteria here")
cr10 = input.text_area(title="Criteria 10", defval="Enter your criteria here")

Text_Pos = input.string(title="Check list location", defval = position.top_right, options = [position.top_right,position.top_left,position.middle_right,position.middle_left,position.bottom_right,position.bottom_left] ,group="Check List Setting")
Header_bg_color = input.color(defval = color.black, title = "Table Color")
Header_text_color = input.color(defval = color.white, title = "Table text Color")
Column_width = input.int(defval=30, title="Column width", minval=5, maxval=50)
// Text_Col = input.color(defval = color.black, title = "Cell text color")
Text_size = input.string(defval = size.small, title = "Cell text font size", options = [size.tiny, size.small, size.normal, size.large])


//Draw table
var table table = table.new(Text_Pos, 2, 11, border_width = 3, frame_width = 3)

//Color when nothing entered
color_blank=color.new(color.white,100)

//Header
table.cell(table, 0, 0, "# ", width = 5, text_color=Header_text_color, bgcolor=Header_bg_color,text_size=Text_size)
table.cell(table, 1, 0, "Criteria", width = Column_width,text_color=Header_text_color,bgcolor=Header_bg_color,text_size=Text_size)

//Items
//#
table.cell(table, 1, 1, cr1, width = Column_width,text_color=cr1 == "" ? color_blank : Header_text_color,bgcolor=cr1 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 2, cr2, width = Column_width,text_color=cr2 == "" ? color_blank : Header_text_color,bgcolor=cr2 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 3, cr3, width = Column_width,text_color=cr3 == "" ? color_blank : Header_text_color,bgcolor=cr3 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 4, cr4, width = Column_width,text_color=cr4 == "" ? color_blank : Header_text_color,bgcolor=cr4 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 5, cr5, width = Column_width,text_color=cr5 == "" ? color_blank : Header_text_color,bgcolor=cr5 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 6, cr6, width = Column_width,text_color=cr6 == "" ? color_blank : Header_text_color,bgcolor=cr6 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 7, cr7, width = Column_width,text_color=cr7 == "" ? color_blank : Header_text_color,bgcolor=cr7 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 8, cr8, width = Column_width,text_color=cr8 == "" ? color_blank : Header_text_color,bgcolor=cr8 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 9, cr9, width = Column_width,text_color=cr9 == "" ? color_blank : Header_text_color,bgcolor=cr9 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 1, 10, cr10, width = Column_width,text_color=cr10 == "" ? color_blank : Header_text_color,bgcolor=cr10 == "" ? color_blank : Header_bg_color,text_size=Text_size)


//Criteria
table.cell(table, 0, 1, "1", width = 5,text_color= cr1 == "" ? color_blank : Header_text_color,bgcolor=cr1 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 2, "2", width = 5,text_color= cr2 == "" ? color_blank : Header_text_color,bgcolor=cr2 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 3, "3", width = 5,text_color= cr3 == "" ? color_blank : Header_text_color,bgcolor=cr3 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 4, "4", width = 5,text_color= cr4 == "" ? color_blank : Header_text_color,bgcolor=cr4 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 5, "5", width = 5,text_color= cr5 == "" ? color_blank : Header_text_color,bgcolor=cr5 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 6, "6", width = 5,text_color= cr6 == "" ? color_blank : Header_text_color,bgcolor=cr6 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 7, "7", width = 5,text_color= cr7 == "" ? color_blank : Header_text_color,bgcolor=cr7 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 8, "8", width = 5,text_color= cr8 == "" ? color_blank : Header_text_color,bgcolor=cr8 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 9, "9", width = 5,text_color= cr9 == "" ? color_blank : Header_text_color,bgcolor=cr9 == "" ? color_blank : Header_bg_color,text_size=Text_size)
table.cell(table, 0, 10, "10", width = 5,text_color= cr10 == "" ? color_blank : Header_text_color,bgcolor=cr10 == "" ? color_blank : Header_bg_color,text_size=Text_size)

