Trader_M
Trader_M

Reputation: 47

PineScript - Mismatched input ')' expecting ':'

New to PineScript, running this code but it gives me an error:

Script:

194 - if av_use

195 - alert(message="e=" + broker + " b=long q="

196 - + tostring(tradePositionSize)

197 - + " s=" + pair

198 - + " t=" + (av_limitOrder ? "limit fp=")

199 - + " fsl=" + tostring(t_stop)

200 - + " ftp=" + tostring(t_target)

201 - + (av_gtdOrder != 0 and av_limitOrder ? gtdString : ""),

202 - freq=alert.freq_once_per_bar_close)

Error:

Line 195: Mismatched input ')' expecting ':'. enter image description here enter image description here

Upvotes: 0

Views: 1061

Answers (1)

Bjorgum
Bjorgum

Reputation: 2310

Your variables in brackets on line 198 make up only part of a ternary operator. Eg

(av_limitOrder ? "limit fp=") 

It’s liking for something to follow as an “else” statement. Like this:

(av_limitOrder ? "limit fp=" : or something else when avlimitorder is false)  

So we need a colon and another alternative variable within the brackets.

Cheers my friend

Upvotes: 1

Related Questions