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

Pine Script errors, as TradingView prints them

69 compiler messages traders search for, each compiled on TradingView from a short script: what causes it, the fix that compiles, and that script loaded in the checker.

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

Try a worked example

Uses when=, transp=, 250 / 100, a ta.* call after and, profit with limit, and no margin settings.

Converted to v6: 3 edits applied · 4 decisions (4 set to keep v5)

Behaves as your v5 script did. Switch any decision below to v6.

Why:Line 1Line 2Line 6Line 8Line 9Line 11Line 12

v5 line 1, removed: //@version=5
v6 line 1, added: //@version=6
v5 line 2, removed: strategy("v5 RSI breakout (worked example)", overlay = true)
v6 line 2, added: strategy("v5 RSI breakout (worked example)", overlay = true, margin_long = 0, margin_short = 0)
basis = ta.sma(close, 20)
basis = ta.sma(close, 20)
rsi = ta.rsi(close, 14)
rsi = ta.rsi(close, 14)
v5 line 6, removed: riskTicks = 250 / 100
v6 line 6, added: riskTicks = int(250 / 100)
v5 line 8, removed: longSignal = close > basis and ta.crossover(rsi, 50)
v6 line 8, added: crossover_8 = ta.crossover(rsi, 50)
v5 line 9, removed: plot(basis, "Basis", color = color.orange, transp = 30)
v6 line 9, added: longSignal = close > basis and crossover_8
v6 line 10, added: plot(basis, "Basis", color = color.new(color.orange, 30))
v5 line 11, removed: strategy.entry("Long", strategy.long, when = longSignal)
v6 line 12, added: if longSignal
v5 line 12, removed: strategy.exit("Exit", "Long", profit = 400, limit = close * 1.03, loss = riskTicks * 100)
v6 line 13, added: strategy.entry("Long", strategy.long)
v6 line 14, added: strategy.exit("Exit", "Long", limit = close * 1.03, loss = riskTicks * 100)
v5 line 1, removed: //@version=5
v5 line 2, removed: strategy("v5 RSI breakout (worked example)", overlay = true)
v6 line 1, added: //@version=6
v6 line 2, added: strategy("v5 RSI breakout (worked example)", overlay = true, margin_long = 0, margin_short = 0)
basis = ta.sma(close, 20)
rsi = ta.rsi(close, 14)
v5 line 6, removed: riskTicks = 250 / 100
v6 line 6, added: riskTicks = int(250 / 100)
v5 line 8, removed: longSignal = close > basis and ta.crossover(rsi, 50)
v5 line 9, removed: plot(basis, "Basis", color = color.orange, transp = 30)
v6 line 8, added: crossover_8 = ta.crossover(rsi, 50)
v6 line 9, added: longSignal = close > basis and crossover_8
v6 line 10, added: plot(basis, "Basis", color = color.new(color.orange, 30))
v5 line 11, removed: strategy.entry("Long", strategy.long, when = longSignal)
v5 line 12, removed: strategy.exit("Exit", "Long", profit = 400, limit = close * 1.03, loss = riskTicks * 100)
v6 line 12, added: if longSignal
v6 line 13, added: strategy.entry("Long", strategy.long)
v6 line 14, added: strategy.exit("Exit", "Long", limit = close * 1.03, loss = riskTicks * 100)
Show the full v6 code
//@version=6
strategy("v5 RSI breakout (worked example)", overlay = true, margin_long = 0, margin_short = 0)

basis = ta.sma(close, 20)
rsi = ta.rsi(close, 14)
riskTicks = int(250 / 100)

crossover_8 = ta.crossover(rsi, 50)
longSignal = close > basis and crossover_8
plot(basis, "Basis", color = color.new(color.orange, 30))

if longSignal
    strategy.entry("Long", strategy.long)
strategy.exit("Exit", "Long", limit = close * 1.03, loss = riskTicks * 100)

Needs your decision

Line 2: strategy() doesn't set margin_long or margin_short

v6 defaults to 100% margin, with margin calls; v5 used 0%.

See line 2 in the diff
Why, and what each choice does

v5 strategies defaulted to 0% margin, which never checks the funds available. v6 defaults to 100%, which can bring margin calls the v5 backtest never had. Setting 0 keeps the v5 backtest. Set your broker's values if you want a realistic one. TradingView's guide on this

Your v5
strategy("v5 RSI breakout (worked example)", overlay = true)
Keep v5: margin_long = 0, margin_short = 0 (keeps v5 behaviour)
strategy("v5 RSI breakout (worked example)", overlay = true, margin_long = 0, margin_short = 0)
Line 6: 250 / 100 divides whole numbers

v6 keeps the fraction: 5 / 2 is 2.5, where v5 gave 2.

See line 6 in the diff
Why, and what each choice does

v5 dropped the fraction when it divided two whole-number constants (5 / 2 was 2). v6 keeps it (2.5). int() keeps v5's result. If v5's whole number was a mistake, use v6's. TradingView's guide on this

Your v5
riskTicks = 250 / 100
Keep v5: int(250 / 100) (keeps v5 behaviour)
riskTicks = int(250 / 100)
Line 8: ta.crossover() on the right of and / or

v6 skips this call on bars where the left side already decides.

See line 8 in the diff
Why, and what each choice does

v5 evaluated both sides of and / or on every bar. v6 skips the right side when the left side already decides, so ta.crossover() misses bars and its history goes wrong. Computing it on the line before keeps v5's result. TradingView's guide on this

Your v5
longSignal = close > basis and ta.crossover(rsi, 50)
Keep v5: compute the call on the line before and use its result (keeps v5 behaviour)
crossover_8 = ta.crossover(rsi, 50)
longSignal = close > basis and crossover_8
Line 12: strategy.exit() has both profit and limit

v6 exits at whichever level comes first; v5 used limit only.

See line 12 in the diff
Why, and what each choice does

v5 used limit and ignored profit when both were given. v6 uses whichever of the two levels the price reaches first, so the exits can move. Removing profit keeps what v5 did. TradingView's guide on this

Your v5
strategy.exit("Exit", "Long", profit = 400, limit = close * 1.03, loss = riskTicks * 100)
Keep v5: remove profit (keeps v5 behaviour)
strategy.exit("Exit", "Long", limit = close * 1.03, loss = riskTicks * 100)
Converted automatically (3)
Notes: no edit needed (1)
  • Past 9,000 orders, v6 drops the oldest instead of stopping. A v5 strategy stopped with an error past 9,000 orders (outside Deep Backtesting). v6 keeps running and drops the oldest ones from its results, so strategy.closedtrades.* on those returns na. strategy.closedtrades.first_index gives the first one kept. TradingView's guide on this

Next: paste it into TradingView's Pine Editor, save, and add it to the chart. An error? Find its message below, or let Pine Fixer fix it. How to add a script

v5 RSI breakout (worked example), Pine v5 strategy

No repaint flags found · 7 Pine v6 migration items

Static repaint checks passed, but the script uses legacy Pine syntax or an older //@version header that needs updating for Pine Script v6.

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

1

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.

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.

Every message, by what went wrong

Compiled on TradingView 23 October 2026. Messages marked v5 are the wording of //@version=5 scripts.

Method and privacy

Method: Each message was printed by TradingView's Pine compiler for the script on its page, compiled on 23 October 2026; each fix compiled with no error or warning. A message gets a page when Google's search suggestions show people looking for it.

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