最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

tradingview api - Pine Script - Mismatched input "end of line without line continuation" expecting ")

programmeradmin5浏览0评论

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 1
Add a comment  | 

2 Answers 2

Reset to default 0

With 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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论