TradingView Pine Script Editor Guide

TradingView Pine Editor: Where to Find, How to Open, and Run Scripts

Open the TradingView Pine Editor from the Pine icon on the right toolbar of a Superchart. Create a script, paste the complete source, save it, and select Add to chart. Use this guide to distinguish editor drafts, saved scripts, and version conversion errors.

Updated for Pine Script v6 & v5•Desktop Supercharts workflow•Official workflow checked October 16, 2026

Quick Answer: Where is the Pine Editor in TradingView and How Do You Open It?

Click the Pine icon on the right toolbar of your Superchart. Older guides may show a bottom tab instead.

  • Create a script: Open the script-name menu and choose Create new.
  • Save a copy: Use Save for a named script in your library.
  • Run it: Click Add to chart and check any compiler messages.

Choose an editor layout

The current editor supports a floating panel, a docked workspace on the right, and a separate browser window or tab. A Move to bottom option provides a horizontal workspace, with some feature limitations. This guide uses desktop Supercharts; it does not assume that a mobile app has the same controls.

TradingView: Pine Editor controls and layouts

TradingView Pine Script Editor Interface Walkthrough

These controls handle separate steps in the edit, save, and run workflow:

Script-name menu

Create a new indicator or strategy, open a saved script, make a copy, or inspect version history.

Code editor

Write or paste source with syntax highlighting and suggestions. The compiler checks syntax when you run the script.

Save

Keep a named copy in your personal library. Publishing is a separate action.

Add to chart

Apply the current script to the active chart. Compilation success does not establish that the trading logic is correct.

Pine Logs

Use More > Pine logs to inspect messages generated by a personal script.

Compiler messages

Read the first error and inspect the indicated code location before fixing subsequent messages.

How to Paste External Code and Run Scripts in Pine Editor

To bring external source into TradingView, open the file in a text editor and copy its contents. Paste the complete code into a new Pine Editor script. For a community script, use its Source code control and make an editable copy if prompted. Protected code cannot be retrieved through this workflow.

01

Open Pine Editor

In a desktop Superchart, click the Pine icon on the right toolbar.

02

Create a separate script

Use the script-name dropdown, then Create new > Indicator or Strategy. Save a copy of existing work before replacing it.

03

Paste the complete source

Replace the template with your code, including its version annotation and declaration. Exclude Markdown fences, line numbers, and explanatory text.

04

Save a named library copy

Choose Save from the script menu and give the script a recognizable name. This stores the code in your personal script library.

05

Add to chart and inspect the result

Click Add to chart. Resolve compiler errors before continuing, then check the plotted values or strategy report. For an existing draft, use Update on chart to apply edits.

Resolving Pine Script Version Mismatch: v5 vs v6

Keep a working v5 script on v5 until you deliberately migrate it. The v6 converter requires the v5 source to compile first. Select Convert code to v6 from the editor menu, fix any remaining errors, then compare outputs and strategy settings. Older scripts must migrate one version at a time.

This complete v6 example plots two EMAs. Paste it into a new indicator to check the import workflow; it is not a trading strategy.

//@version=6
indicator("Dual EMA Trend Filter", overlay = true)
fastEma = ta.ema(close, 9)
slowEma = ta.ema(close, 21)
plot(fastEma, "Fast EMA", color = color.blue, linewidth = 2)
plot(slowEma, "Slow EMA", color = color.orange, linewidth = 2)

The ta.ema calls use the technical-analysis namespace. Changing only the version annotation of an older script does not update its function names or behavior. Read TradingView's v6 migration guide.

Debugging Compile and Runtime Errors in Pine Editor

Start with the first compiler message and its code location. Once the script compiles, use its runtime error message or Pine Logs to inspect a failure that occurs on the chart:

Pasted formatting or incomplete source

Unexpected characters or missing declaration

Remove Markdown code fences and copied line numbers. Confirm that the full script includes one declaration. A snippet from an answer may need the surrounding script to compile.

Read the Pine Script coding guides

Line continuation and indentation

End of line without line continuation

Check the highlighted line and the preceding line for missing commas, quotes, or parentheses. Local blocks use four spaces or a tab per level. Wrapped expressions have version-specific rules, so preserve the source formatting rather than adding arbitrary indentation.

Diagnose a line continuation error

Legacy function names under a newer version

Function or function reference not found

A v4 script may use study() and sma(), while v5/v6 use indicator() and ta.sma(). Restore the original version first, then migrate with the editor converter and official guides. Renaming functions alone may not preserve behavior.

Explore Pine Script versions and syntax

Chart capacity or runtime errors

The code compiles but does not run

A plan limit is separate from a syntax error. Remove an unused chart indicator if capacity is reached. For a runtime failure, inspect its message, inputs, and requested data; combining code does not remove Pine resource limits.

Understand chart and script limits

Inspect Values with Pine Logs (log.info())

Available in Pine Script v5 and v6

Add logging calls to a personal copy when you need to inspect calculated values. This example plots RSI and logs a confirmed-bar cross above 30. Published scripts do not generate Pine Logs.

//@version=6
indicator("Pine Logs Diagnostic", overlay = false)
rsiValue = ta.rsi(close, 14)
crossedAbove30 = ta.crossover(rsiValue, 30)
plot(rsiValue, "RSI")
if crossedAbove30 and barstate.isconfirmed
    log.info("RSI crossed above 30 at bar {0}: RSI={1}", bar_index, rsiValue)

How to inspect the output:

  1. Click "Add to chart" in the Pine Editor.
  2. Open More > Pine logs in the editor, or use the script's menu on the chart.
  3. Filter by Information, Warnings, or Errors to verify variable states bar-by-bar.

Need more examples for syntax, functions, and common compilation issues?

Browse our full Pine Script Coding & Debugging Hub
No Coding Required

Build a Script in Pineify, Then Check It in TradingView

Writing Pine Script by hand in TradingView requires managing data series, namespace migrations, indentation rules, and compiler versions. Pineify provides visual controls for indicator conditions and strategy settings, then generates Pine Script for you to inspect in TradingView.

Configure Indicator Conditions

Choose supported indicators, set their inputs, and define the conditions you want to evaluate.

Combine Conditions

Use multiple conditions in one script. Review scale, pane placement, and Pine resource limits before adding more outputs.

Visual Strategy Builder

Configure entry and exit rules, then review the exported strategy in TradingView. Backtest results depend on your assumptions and test settings.

Export and Verify

Copy generated Pine Script into the editor, compile it, and check its chart behavior. Generated code still needs review against your intended rules.

Create Pine Script for Your Chart

Configure indicator conditions or strategy rules, export the Pine Script, and use the workflow above to inspect it in TradingView. For a prompt-based workflow, explore the AI Coding Agent.

Frequently Asked Questions

TradingView Pine Editor Questions & Answers

Direct answers to common questions about finding, configuring, saving, and debugging scripts in TradingView.