Drawing multiple horizontal levels
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mr_coffeefe

// This is a simple Indicator to draw pricelevels or any kind of horizontal levels into your chart.


//@version=5
indicator("MC Levels", overlay=true, max_lines_count=500)

MCLevelsString = input.string(title="Insert Levels here", defval="4500.00, 4550.50, 4600")
seperator = input.string(",", title = "Insert the seperator here")
extendOption = input.string("both", title="Line Extension", 
     options=["none", "left", "right", "both"])

lineColor = input.color(color.rgb(223, 64, 251, 80), title = 'Choose the line color here')
lineWidth = input.int(3, 'Line Width')

mclevels = str.split(MCLevelsString, seperator)

lineExtend = extendOption == "left" ? extend.left :
     extendOption == "right" ? extend.right :
     extendOption == "both" ? extend.both :
         extend.none

for i = 0 to array.size(mclevels)-1
    line.new(bar_index,str.tonumber(array.get(mclevels, i)),bar_index+1,str.tonumber(array.get(mclevels, i)), xloc=xloc.bar_index, extend=lineExtend, width=lineWidth, color=lineColor)