Mismatched input '<end of line>' expecting '<statement>'This parser error means a line ended where Pine still expected more code — almost always broken indentation or an incomplete multi-line statement. Educational content only; not financial advice and no claim of profitability.
Pine's parser hit the end of a line while it was still waiting for a valid statement or the rest of an expression. Typical triggers: an if/for/function body that is not indented (Pine requires exactly 4 spaces or 1 tab for a block, and continuation lines of a wrapped statement need a non-multiple-of-4 indent), a dangling assignment such as `x =` with nothing after it, or mixing tabs and spaces so the indent level is ambiguous. The literal token shown may be '<end of line>' and the 'expecting' clause names what the parser wanted instead.
Give every block body a consistent 4-space (or single-tab) indent, and make sure no statement is left half-finished. If you wrap one statement across lines, indent the continuation lines by an amount that is NOT a multiple of 4 (e.g. put the operator at the end of the first line and indent the next). Do not put comments on wrapped continuation lines.
//@version=6
indicator("Mismatched demo", overlay=true)
if close > open
signal = true
plotshape(close > open, title="Up")✓ Validated clean by our own engine
//@version=6
indicator("Mismatched demo", overlay=true)
var bool signal = false
if close > open
signal := true
plotshape(signal and barstate.isconfirmed, title="Up", style=shape.triangleup, location=location.belowbar, color=color.green)Educational, code-correctness reference only — not financial advice. Trading involves substantial risk of loss.