here is the instructions:
1.script gets the input string
2.separates that by |
3.then separate each part again by “,”
4.then draws a line for each value.
so far I have come to this mess:
//@version=5
indicator("Split Example", overlay=true)
paste_values_here = input(defval = "GEXFLIPS,147, 148, 150, 153, 156, 159, 161, 165, 166, 180, 181, 182, 183, 184, 186, 187, 188, 189|GEXLEVELSP,147, 157, 200|GEXLEVELSN,192, 205|GEXLEVELSHP,147, 200, 157|GEXLEVELSHN,205, 192|VOLLEVELSC,195|VOLLEVELSP,174, 186|VOLLEVELSHC,195|VOLLEVELSHP,174, 186")
parts = array.new_string(0)
if bar_index == 0
parts := str.split(paste_values_here, "|")
// Assign each part to a new variable
gexFlips = array.new_string(0)
gexLevelsP = array.new_string(0)
gexLevelsN = array.new_string(0)
gexLevelsHP = array.new_string(0)
gexLevelsHN = array.new_string(0)
volLevelsC = array.new_string(0)
volLevelsP = array.new_string(0)
volLevelsHC = array.new_string(0)
volLevelsHP = array.new_string(0)
if bar_index == 0
array.push(gexFlips, array.get(parts, 0))
array.push(gexLevelsP, array.get(parts, 1))
array.push(gexLevelsN, array.get(parts, 2))
array.push(gexLevelsHP, array.get(parts, 3))
array.push(gexLevelsHN, array.get(parts, 4))
array.push(volLevelsC, array.get(parts, 5))
array.push(volLevelsP, array.get(parts, 6))
array.push(volLevelsHC, array.get(parts, 7))
array.push(volLevelsHP, array.get(parts, 8))
if bar_index == 0
log.info(array.get(gexFlips, 0))
if bar_index == 0
gexFlipsStr = array.get(gexFlips, 0)
gexFlipsParts = str.split(gexFlipsStr, ",")
for i = 1 to array.size(gexFlipsParts) - 1
levelStr = str.trim(array.get(gexFlipsParts, i))
level = str.tonumber(levelStr)
hline(level, "GEXFLIPS " + levelStr, color=color.blue)
I have tried many other ways but still cannot find the right method to achieve this.
apparently the problem with the code above is that :
Cannot call ‘hline’ with argument ‘price’=’level’. An argument of ‘series float’ type was used but a ‘input float’ is expected.