◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Pine errors / Syntax
Pine Script v6 error · Syntax

Pine Script v6 "Mismatched input '<end of line>' expecting '<statement>'" — cause & fix

The error
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.

Why it happens

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.

How to fix it

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.

What triggers it

//@version=6
indicator("Mismatched demo", overlay=true)
if close > open
signal = true
plotshape(close > open, title="Up")

The fix, in code

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

Related errors

Educational, code-correctness reference only — not financial advice. Trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro