// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © BacktestTerminal //@version=5 indicator("Manual Draw Horizontal Lines", "Horizontal Line", overlay=true) // Input l_align = input.string("Right", "Alignment", ["Right", "Left"], group="TEXT STYLE") l_size = input.string("Normal", "Size", ["Huge", "Large", "Normal", "Small", "Tiny"], group="TEXT STYLE") l_font = input.string("Default", "Font", ["Monospace", "Default"], group="TEXT STYLE") b_r5 = input.bool(true, "", inline="r5") t_r5 = input.string("Resistance 5", "", inline="r5") i_r5 = input.float(2050.55, "", inline="r5") c_r5 = input.color(color.rgb(240, 0, 255, 0), "", inline="r5") b_r4 = input.bool(true, "", inline="r4") t_r4 = input.string("Resistance 4", "", inline="r4") i_r4 = input.float(2025.55, "", inline="r4") c_r4 = input.color(color.rgb(240, 0, 255, 0), "", inline="r4") b_r3 = input.bool(true, "", inline="r3") t_r3 = input.string("Resistance 3", "", inline="r3") i_r3 = input.float(2000.55, "", inline="r3") c_r3 = input.color(color.rgb(240, 0, 255, 0), "", inline="r3") b_r2 = input.bool(true, "", inline="r2") t_r2 = input.string("Resistance 2", "", inline="r2") i_r2 = input.float(1975.55, "", inline="r2") c_r2 = input.color(color.rgb(240, 0, 255, 0), "", inline="r2") b_r1 = input.bool(true, "", inline="r1") t_r1 = input.string("Resistance 1", "", inline="r1") i_r1 = input.float(1950.55, "", inline="r1") c_r1 = input.color(color.rgb(240, 0, 255, 0), "", inline="r1") b_s1 = input.bool(true, "", inline="s1") t_s1 = input.string("Support 1", "", inline="s1") i_s1 = input.float(1900.55, "", inline="s1") c_s1 = input.color(color.rgb(0, 130 ,255, 0), "", inline="s1") b_s2 = input.bool(true, "", inline="s2") t_s2 = input.string("Support 2", "", inline="s2") i_s2 = input.float(1875.55, "", inline="s2") c_s2 = input.color(color.rgb(0, 130 ,255, 0), "", inline="s2") b_s3 = input.bool(true, "", inline="s3") t_s3 = input.string("Support 3", "", inline="s3") i_s3 = input.float(1850.55, "", inline="s3") c_s3 = input.color(color.rgb(0, 130 ,255, 0), "", inline="s3") b_s4 = input.bool(true, "", inline="s4") t_s4 = input.string("Support 4", "", inline="s4") i_s4 = input.float(1825.55, "", inline="s4") c_s4 = input.color(color.rgb(0, 130 ,255, 0), "", inline="s4") b_s5 = input.bool(true, "", inline="s5") t_s5 = input.string("Support 5", "", inline="s5") i_s5 = input.float(1800.55, "", inline="s5") c_s5 = input.color(color.rgb(0, 130 ,255, 0), "", inline="s5") tab = switch l_align "Right" => 1 "Left" => 0 // Switch labelAline = switch l_align "Right" => chart.right_visible_bar_time "Left" => chart.left_visible_bar_time labelSize = switch l_size "Huge" => size.huge "Large" => size.large "Normal" => size.normal "Small" => size.small "Tiny" => size.tiny labelText = switch l_font "Monospace" => font.family_monospace "Default" => font.family_default ss(price)=> tabx = ' ' for i=10 to (str.length(price)) tabx := tabx+' ' tabx // Function to create or modify a label f_label(_show, _text, _price, _color) => text_ = str.tostring(_text) + " : " + str.tostring(_price) if _show _label = label.new(labelAline, _price, tab == 1? text_+ss(text_):ss(text_)+text_, xloc=xloc.bar_time, style=label.style_none, textcolor=_color) label.set_size(_label, labelSize) label.set_text_font_family(_label, labelText) label.delete(_label[1]) // Key Level Plot hline(b_r5 ? i_r5 : na, "", c_r5, hline.style_solid, 1) hline(b_r4 ? i_r4 : na, "", c_r4, hline.style_dashed, 1) hline(b_r3 ? i_r3 : na, "", c_r3, hline.style_dashed, 1) hline(b_r2 ? i_r2 : na, "", c_r2, hline.style_dotted, 1) hline(b_r1 ? i_r1 : na, "", c_r1, hline.style_dotted, 1) hline(b_s1 ? i_s1 : na, "", c_s1, hline.style_dotted, 1) hline(b_s2 ? i_s2 : na, "", c_s2, hline.style_dotted, 1) hline(b_s3 ? i_s3 : na, "", c_s3, hline.style_dashed, 1) hline(b_s4 ? i_s4 : na, "", c_s4, hline.style_dashed, 1) hline(b_s5 ? i_s5 : na, "", c_s5, hline.style_solid, 1) // Labels f_label(b_r5, t_r5, i_r5, c_r5) f_label(b_r4, t_r4, i_r4, c_r4) f_label(b_r3, t_r3, i_r3, c_r3) f_label(b_r2, t_r2, i_r2, c_r2) f_label(b_r1, t_r1, i_r1, c_r1) f_label(b_s1, t_s1, i_s1, c_s1) f_label(b_s2, t_s2, i_s2, c_s2) f_label(b_s3, t_s3, i_s3, c_s3) f_label(b_s4, t_s4, i_s4, c_s4) f_label(b_s5, t_s5, i_s5, c_s5)