Search code examples
pythonpine-scriptindicator

Mismatched input ',' expecting ')'


I'm running this code to add to the script I've been compiling now but I'm getting this error and I just can't figure out what's wrong with it:

line 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)

Solution

  • While declaring SMI_Long_Exit and SMI_Short_Exit boolean variables you used plot's function arguments (style, linewidth, color).

    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)