New

Complete Suite: all 11 tools. 5 new Premium desks inside.All 11 tools $557.98 one by one

$557.98 one by one $97 once Save $460.98Get the SuiteGet it

Mismatched input 'if' expecting 'end of line without line continuation'

Indent the inner if four spaces under the outer one, and its own body four more.

Updated 23 October 2026. Runs in your browser; nothing you type is uploaded.

Try a worked example

My script, Pine v5 strategy

TradingView's compiler stops at line 4

Mismatched input 'if' expecting 'end of line without line continuation'

Static checks, which read the code as written: No repaint flags found · 2 Pine v6 migration items. Edit the script and the compiler line goes; the checks below follow your edits.

Critical repaint flags

0

0 caution flags to verify

Bar-close gate

Not found

barstate.isconfirmed or a bar-close alert

Higher-timeframe calls

0

request.security() calls, of a 40 limit

Plots and alerts

0

Plots, of a 64 limit; 0 alerts

Repaint and lookahead

No lookahead leaks, unshifted request.security() calls or realtime-only signal branches found in this snippet.

Pine Script v6 migration checklist

These lines don't compile in v6, or behave differently. Check each one (TradingView's guide).

  • Line 1: Script targets Pine Script v5 (current is v6)Caution

    Line 1 declares //@version=5. Changing the header alone does not convert the script: v6 changed how bools, division, conditions and some strategy settings behave.

    Fix: Convert it with the Pine Editor's built-in converter (TradingView's migration guide shows where), then work through the items listed here.

    TradingView's guide on this
  • Line 2: Strategy without margin_long / margin_shortCaution

    v6 strategies default to 100% margin, which can bring margin calls a v5 backtest never had.

    Fix: Set margin_long and margin_short in strategy() to the values your broker uses.

    TradingView's guide on this

Want TradingView indicators whose Pine Script v6 source already passes every check?

Every desk in Pine Pro Library ships as readable .pine v6 source with confirmed higher-timeframe requests and barstate.isconfirmed event logging.

What causes it

An if nested inside another if is not indented, so the compiler reads the outer if as having no body. This is Pine v5's wording.

The fix, compiled

Indent the inner if four spaces under the outer one, and its own body four more.

Prints the error at line 4
//@version=5
strategy("My script")
if close > open
if high > high[1]
    strategy.entry("L", strategy.long)
Compiles with no error
//@version=6
strategy("My script")
if close > open
    if high > high[1]
        strategy.entry("L", strategy.long)

The same mistake in Pine v6

Compiled as //@version=6, the same code prints, at line 4:

Mismatched input "if" expecting set "end of line without line continuation"

That message, with its own fix

Syntax: lines, brackets and characters

Compiled on TradingView 23 October 2026. The checker above reads repaint and v6 migration patterns; TradingView's compiler is the final word on whether a script compiles.

Method and privacy

Method: The script loaded in the checker was compiled on TradingView's Pine compiler on 23 October 2026 as //@version=5, and printed this error at line 4; the fix below compiled with no error or warning. Names such as variables come from the example and will differ in your script.

Calculations run entirely in your browser — nothing you type is uploaded. Your last numbers stay in this browser so you can pick up where you left off; Forget them clears them. A link with your numbers carries them after the # sign, which browsers do not send to servers, and the page takes them out of the address before any analytics loads. Copy and download actions save your calculation locally. The site may record coarse tool actions under its privacy policy, without inputs, results, file contents or filenames.

Have your AI fix the next one

  • Pine Fixer An AI skill pack for 45 compiler-verified Pine v6 failure classes, with a repaint clinic. $9.99 once.

Goes deeper

Limits and trading risk

These tools calculate from your inputs, supported historical records or explicitly labelled teaching examples. They do not verify a live account, predict future returns or confirm that a broker or prop-firm rule has been met. Missing costs, floating losses and changed market conditions can materially change outcomes. Trading can lose the capital committed to it; check the stated method and your account specifications.

Read the risk disclosure