不匹配的输入 ',' 期待 ')'

Mismatched input ',' expecting ')'

我运行将这段代码添加到我现在正在编译的脚本中,但我收到了这个错误,我无法弄清楚它有什么问题:

第 1 行:

mismatched input ',' expecting ')'

SMI_Long_Exit = (cross(sig, erg) and (sig>erg) and sig>0 ? : na, color=color.green, style=plot.style_circles, linewidth=2)
SMI_Short_Exit = (cross(sig, erg) and (erg>sig) and erg<0 ? : na, color=color.red, style=plot.style_circles, linewidth=2)

plotchar(SMI_Long_Exit, color = color.green, location = location.abovebar, text="EXIT LONG", transp=0)
plotchar(SMI_Short_Exit, color = color.red, location = location.belowbar, text="EXIT SHORT", transp=0)

在声明 SMI_Long_ExitSMI_Short_Exit 布尔变量时,您使用了 plot 的函数参数(样式、线宽、颜色)。

SMI_Long_Exit = cross(sig, erg) and (sig>erg) and sig>0
SMI_Short_Exit = cross(sig, erg) and (erg>sig) and erg<0

plotchar(SMI_Long_Exit, color=color.green, location=location.abovebar, text="EXIT LONG", transp=0)
plotchar(SMI_Short_Exit, color=color.red, location=location.belowbar, text="EXIT SHORT", transp=0)