SuperCharting
Sign in Get started Account Open charts

Learn / Strategies

Pine Script code checker and fixer: find and fix script errors online

Check Pine Script code online for free: SuperCharting's Script Editor finds errors with line numbers, and Auto-fix repairs common mistakes for you.

A Pine Script code checker tells you whether a script will compile and run, and where it breaks if it will not. SuperCharting's Script Editor does this in the browser: it checks your code as you type, points to the line of each error, and has an Auto-fix button that repairs common mistakes and lists every change it made. It is free for now and needs no install. Pine Script is TradingView's language; SuperCharting runs scripts written in the same version 6 syntax in its own engine, and the Pine compatibility page lists which features are supported.

How to check a Pine Script for errors

  1. Open a chart, then open the Script Editor with Ctrl + E or the Script Editor button in the right-hand bar.
  2. Paste your script into the code area, replacing the starter template.
  3. About 600 milliseconds after you stop typing, the console shows the result:
  1. Click Add to chart. Some mistakes show only when the script runs on real bars, such as a misspelt function name. Those appear as a line that starts with Runtime:, again with the line number, for example Runtime: line 3, bar 0: unknown function ta.foo().

So there are two checks: the compile check while you type, and the run check when the script goes on the chart. A script that passes both is ready to use.

What Auto-fix repairs

When the console shows an error, press Auto-fix, the button right after Save in the editor header. The console shows "Auto-fix: reading your script…". It then puts the fixed version in the editor and lists each change in plain words, for example "Line 3: tab indent replaced with 4 spaces." The last line tells you where the script stands: ✓ The script compiles and runs, or ✗ Still wrong with the line that still has a problem. If you do not like the result, choose Undo Auto-fix in the More menu to get your original back.

The built-in fixer, on every account, handles two kinds of problem:

Auto-fix never edits text inside strings or comments, except the quote characters themselves. If a change would leave the script worse than before, that change is dropped. Every account can run Auto-fix up to 40 times an hour.

The deeper AI check

For accounts the site owner enables, Auto-fix also runs an AI pass after the built-in one. It can fix what simple rules cannot, such as a missing comma between arguments or a block indented wrongly. The console then says "Auto-fix (full AI check)". The AI result is checked again in the same way, and it is kept only if it is no worse than the built-in fixer's. Like any AI it can be wrong, so read the list of changes before you rely on the script.

Common Pine Script errors and what they mean

Console messageUsual causeFix
unexpected 'EOF'A bracket or string was opened and never closedClose it. Auto-fix does this for you
unknown function ta.foo() (Runtime)A misspelt or non-existent functionCorrect the name. Auto-fix picks the closest real one
An error on study(Code from Pine version 4 or olderAuto-fix converts it to indicator( and version 6
An error on sma( or rsi( without ta.Version 4 functions had no namespaceAuto-fix adds ta. or math.
A variable cannot be reassigned= used where := is neededAuto-fix changes it when the variable was declared before

After the check passes

What the checker does not do

TradingView and Pine Script are trademarks of TradingView, Inc. SuperCharting is independent and not affiliated with it.

Try it on a live chart

SuperCharting is an AI-enabled charting and coding platform in your browser: charts, Pine-compatible scripts with AI Auto-fix, the Strategy Tester, alerts and the screener.

Create a free account More guides