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

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

//------------------------------------------------------------------------------------
// Trading Checklist
//------------------------------------------------------------------------------------
_titleGrp = "Title"
_TitleTxt = input.string("Trading Checklist", "Title", inline="1", group=_titleGrp)
title_text_color = input.color(#14a9e4b0, "", inline="1", group=_titleGrp)
_titleTextSize = input.string('Large', 'Text Size', options=['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], group=_titleGrp)
titleTextSize = _titleTextSize == 'Auto' ? size.auto : _titleTextSize == 'Tiny' ? size.tiny : _titleTextSize == 'Small' ? size.small : _titleTextSize == 'Normal' ? size.normal : _titleTextSize == 'Large' ? size.large : size.huge
_title_alignment = input.string('Center', 'Text Alignment ', group=_titleGrp, options=['Left', 'Center', 'Right'])
title_alignment = _title_alignment == "Left" ? text.align_left : _title_alignment == "Center" ? text.align_center : text.align_right

_bodyGrp = "Body"
_midTxt = input.text_area("TRADING PLAN\n✅ Trend Direction\n✅ Support & Resistance\n\nRISK MANAGEMENT\n✅ Risk 1%\n\nPSYCHOLOGY\n✅ Don't Chase!", "Body", group=_bodyGrp)
body_text_color = input.color(#d6d6d6b0, "Text Color", group=_bodyGrp)
bg_color = input.color(#00000000, "Background Color", group=_bodyGrp)
_bodyTextSize = input.string('Normal', 'Text Size', options=['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], group=_bodyGrp)
bodyTextSize = _bodyTextSize == 'Auto' ? size.auto : _bodyTextSize == 'Tiny' ? size.tiny : _bodyTextSize == 'Small' ? size.small : _bodyTextSize == 'Normal' ? size.normal : _bodyTextSize == 'Large' ? size.large : size.huge
_txt_alignment = input.string('Left', 'Text Alignment ', group=_bodyGrp, options=['Left', 'Center', 'Right'])
txt_alignment = _txt_alignment == "Left" ? text.align_left : _txt_alignment == "Center" ? text.align_center : text.align_right

_tableGrp = "Position"
_tableYpos = input.string('Top', '↕ ', inline='01', group=_tableGrp, options=['Top', 'Middle', 'Bottom'])
tableYpos = _tableYpos == "Top" ? "top" : _tableYpos == "Bottom" ? "bottom" : "middle"
_tableXpos = input.string('Right', '   ↔', inline='01', group=_tableGrp, options=['Left', 'Center', 'Right'], tooltip='Position on the chart.')
tableXpos = _tableXpos == "Right" ? "right" : _tableXpos == "Center" ? "center" : "left"

// Draw Table
var tradingPanel = table.new(position= tableYpos + '_' + tableXpos , columns=1, rows=3, bgcolor=bg_color, border_width = 0)
if barstate.islast
    // Title
    table.cell(table_id=tradingPanel, column=0, row=0, text=_TitleTxt, text_size=titleTextSize, text_color=title_text_color, text_halign = title_alignment)
    // Body
    table.cell(table_id=tradingPanel, column=0, row=1, text=_midTxt, text_size=bodyTextSize, text_color=body_text_color, text_halign = txt_alignment)
