PINE//OPS
STATUSSTANDBY

Pine Script v4 → v5 / v6 converter

Paste v4 code, press → v5 or → v6, then Compile to verify.

v6
Press Compile to plot your script.
DATASAMPLE (600 daily bars)

How the converter works

The converter works on the token stream of your script, so comments, spacing and line breaks are preserved. It applies the renames from the official migration guides:

v4v5 and later
study()indicator()
sma(), ema(), rsi(), crossover()…ta.sma(), ta.ema(), ta.rsi(), ta.crossover()…
abs(), max(), round()…math.abs(), math.max(), math.round()…
security()request.security()
tostring()str.tostring()
input(14, type=input.integer)input.int(14)
iff(c, a, b)(c ? a : b)
color=color.red, transp=80color=color.new(color.red, 80)

After converting, press Compile. The checker runs the converted script against the target version's rules, so anything the converter could not handle shows up as a normal error with a line number.

Frequently asked questions

Does it convert v5 to v6 too?

Yes. Scripts that are already v5 show a → v6 button. Most v5 code only needs the version line changed; the converter also moves transp into color.new() and lists the v6 behaviour changes to review.

Can it convert v1, v2 or v3 scripts?

No. Upgrade those to v4 with the converter built into TradingView's editor first, then bring them here.

Is this the official TradingView compiler?

No. PineOps is an independent Pine Script engine written from scratch that runs in your browser. It checks syntax and version rules, executes your script bar by bar and plots the result. It covers a large subset of the language; anything it does not support yet is reported as a clear error rather than silently ignored.

Is my code sent to a server?

No. Compilation and execution happen entirely in your browser. Share links store the code in the URL fragment, which browsers do not send to servers.

Related tools

Recon mode — drag to orbit · click to ping · scroll for altitude