◆ 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 "end of line without line continuation" error — cause & fix

The error
Syntax error at input 'end of line without line continuation'

Pine expected a wrapped statement to continue on the next line but the indentation broke the continuation, so it read a premature line end. Educational content only; not financial advice and no profitability claim.

Why it happens

When one statement spans several lines, each continuation line must be indented by an amount that is NOT a multiple of 4 spaces (a multiple of 4 reads as a new code block instead of a continuation). If you break a long expression and indent the next line by 4 or 8 spaces, or leave a trailing operator with a same-level next line, the parser sees the line end before the statement is complete and raises this error. Comments placed on continuation lines cause it too.

How to fix it

Keep the wrapped statement on continuation lines indented by a non-multiple-of-4 (a common convention is to end the first line with the operator and indent the continuation by one or more spaces that don't total a multiple of 4). Simplest robust fix: put the whole expression on a single line, or split it into intermediate variables. Never add comments on the wrapped lines.

What triggers it

//@version=6
indicator("Continuation demo", overlay=true)
longSignal = ta.crossover(ta.sma(close, 10), ta.sma(close, 20)) and
close > ta.sma(close, 50)
plotshape(longSignal, title="Long")

The fix, in code

✓ Validated clean by our own engine

//@version=6
indicator("Continuation demo", overlay=true)
fast = ta.sma(close, 10)
slow = ta.sma(close, 20)
trend = ta.sma(close, 50)
longSignal = ta.crossover(fast, slow) and close > trend
plotshape(longSignal and barstate.isconfirmed, title="Long", 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