You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Pine Script报错:Mismatched input 'end of line...' expecting ')' 如何解决?

Pine Script报错"Mismatched input 'end of line without line continuation' expecting ')'"的解决办法

这个错误是Pine Script解析多行函数参数时的语法规则问题,针对你提供的代码,有几种可行解决方式:

  • 给最后一个参数添加逗号:在label.new()的最后一个参数行末尾加逗号,让编辑器正确识别多行参数结构,修改后代码如下:
if newSellSignal
    label.new(
        bar_index,
        high,
        "SELL\n" + str.tostring(math.round(signalQuality)) + "%",
        style=label.style_label_down,
        color=color.red,
        textcolor=color.white,
        size=signalQuality >= 80 ? size.normal : size.small,
    )
  • 将三元表达式单独赋值:把参数里的三元运算逻辑提取为单独变量,再传入函数,避免在参数列表中直接使用复杂表达式,代码示例:
if newSellSignal
    labelSize = signalQuality >= 80 ? size.normal : size.small
    label.new(
        bar_index,
        high,
        "SELL\n" + str.tostring(math.round(signalQuality)) + "%",
        style=label.style_label_down,
        color=color.red,
        textcolor=color.white,
        size=labelSize
    )
  • 检查隐藏特殊字符:如果上述方法无效,可能是代码中存在非标准空格、换行符等隐藏字符,尝试手动重新输入label.new()的参数部分,确保语法干净。

内容的提问来源于stack exchange,提问作者excalibur

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 02:21:10