error messageMismatched input "end of line without line continuation" expecting ")"
Hi world, I get the error above for box.new( Im not sure what to do. Can anyone make a suggestion, please?
// ✅ Function to Draw FVGs
draw_fvg(_ary, col) =>
if array.size(_ary) > 0
for i = 0 to array.size(_ary) - 1
value = array.get(_ary, i)
box.new(
left = value.left,
top = value.top,
right = value.right,
bottom = value.bot,
bgcolor = col,
border_color = color.gray,
xloc = xloc.bar_index
)
I tried the suggestions of the other posts but to no avail.
error messageMismatched input "end of line without line continuation" expecting ")"
Hi world, I get the error above for box.new( Im not sure what to do. Can anyone make a suggestion, please?
// ✅ Function to Draw FVGs
draw_fvg(_ary, col) =>
if array.size(_ary) > 0
for i = 0 to array.size(_ary) - 1
value = array.get(_ary, i)
box.new(
left = value.left,
top = value.top,
right = value.right,
bottom = value.bot,
bgcolor = col,
border_color = color.gray,
xloc = xloc.bar_index
)
I tried the suggestions of the other posts but to no avail.
Share Improve this question asked Mar 17 at 16:47 Tracy FrancisTracy Francis 12 Answers
Reset to default 0With the box.new()
you are line-wrapping.
Syntactically, a statement must begin at the beginning of the line. If it wraps to the next line then the continuation of the statement must begin with one or several (different from multiple of 4) spaces.
Your new lines all have 16 spaces which is a multiple of 4. Just add one more space and it will be good.
// ✅ Function to Draw FVGs
draw_fvg(_ary, col) =>
if array.size(_ary) > 0
for i = 0 to array.size(_ary) - 1
value = array.get(_ary, i)
box.new(
left = value.left,
top = value.top,
right = value.right,
bottom = value.bot,
bgcolor = col,
border_color = color.gray,
xloc = xloc.bar_index)
Watch the vertical helplines in the editor. pine coding is position sensitive - its important for the compiler at which position from left the coding starts, which will define if its a local block (on the line) or continuation (between the lines). I was confused a lot of times in the pine script beginning as well coming from other environments where that didnt even matter and was just for readability.
consider for ... in .. to loooooooop through the array.
hope this helps