Round Number Zones
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © trading-guide

//@version=5
indicator("Round Number Zones", overlay=true)

line_col = input(color.gray, title ="Line color")
line_width = input.int(2, title = "Line width", minval = 1, maxval = 5)

line_count = input.int(title="Line count",  defval=10)
line_count_2 = math.floor(line_count / 2)

// Symbol 1 : EURUSD default
show_sym_1 = input.bool(title="Show", defval=true, inline="2")
sym_1 = input.symbol("EURUSD",title=" ", inline="2")
sym_1_steps = input.float(title="+/-",  defval=0.001, inline="2")

sym_1_sec = request.security(sym_1,timeframe.period, close)
sym_1_use_custom_price = input.bool(title="Custom Price", defval=false, inline="3")
sym_1_custom_price = input.float(title="", defval=1.08, inline="3")

// Symbol 2 : GOLD default
show_sym_2 = input.bool(title="Show", defval=true, inline="4")
sym_2 = input.symbol("GOLD",title=" ", inline="4")
sym_2_steps = input.float(title="+/-",  defval=5, inline="4")

sym_2_sec = request.security(sym_2,timeframe.period, close)
sym_2_use_custom_price = input.bool(title="Custom Price", defval=false, inline="5")
sym_2_custom_price = input.float(title="", defval=1900, inline="5")

// Symbol 3 : US30 default
show_sym_3 = input.bool(title="Show", defval=true, inline="6")
sym_3 = input.symbol("US30",title=" ", inline="6")
sym_3_steps = input.float(title="+/-",  defval=50, inline="6")

sym_3_sec = request.security(sym_3,timeframe.period, close)
sym_3_use_custom_price = input.bool(title="Custom Price", defval=false, inline="7")
sym_3_custom_price = input.float(title="", defval=3500, inline="7")


draw_line(sym, show, steps, custom, custom_price) =>
    if sym == syminfo.prefix + ":" +syminfo.ticker and show
        for i = 0 to line_count - 1
            price = custom ? custom_price : close
            step = math.ceil(price / steps) * steps + (i * steps) - (line_count_2 * steps)
        
            line.new(bar_index, step, bar_index - 1, step, xloc=xloc.bar_index, extend=extend.both, color=line_col, width=line_width, style=line.style_dotted)

draw_line(sym_1, show_sym_1, sym_1_steps, sym_1_use_custom_price, sym_1_custom_price)
draw_line(sym_2, show_sym_2, sym_2_steps, sym_2_use_custom_price, sym_2_custom_price)
draw_line(sym_3, show_sym_3, sym_3_steps, sym_3_use_custom_price, sym_3_custom_price)