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.
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 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.
Open Pine Editor
In a desktop Superchart, click the Pine icon on the right toolbar.
Create a separate script
Use the script-name dropdown, then Create new > Indicator or Strategy. Save a copy of existing work before replacing it.
Paste the complete source
Replace the template with your code, including its version annotation and declaration. Exclude Markdown fences, line numbers, and explanatory text.
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.
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 declarationRemove 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 guidesLine continuation and indentation
End of line without line continuationCheck 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 errorLegacy function names under a newer version
Function or function reference not foundA 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 syntaxChart capacity or runtime errors
The code compiles but does not runA 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 limitsInspect 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:
- Click "Add to chart" in the Pine Editor.
- Open More > Pine logs in the editor, or use the script's menu on the chart.
- 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 HubBuild 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.
TradingView Pine Editor Questions & Answers
Direct answers to common questions about finding, configuring, saving, and debugging scripts in TradingView.
Open a Superchart and click the Pine icon on the right toolbar. The editor opens in a floating panel; docking and detached-window options let you choose a workspace layout.
Open the dropdown beside the script name, choose Create new, and select Indicator or Strategy. Replace the entire example with the complete source you want to run. Keep the original version directive when importing older code.
TradingView restores the editor state, including unsaved edits, when you reopen it. Use Save to store a named script in your personal script library. A restored editor buffer and a saved library script serve different purposes.
Save stores your script in your library. Add to chart runs it on the active chart and can create a temporary draft; Update on chart applies edits to that draft. Publishing is a separate sharing workflow and is not required to use your own code.
No. Saving to your personal library does not publish the script. Publication has separate privacy settings (public or private) and code visibility settings (open-source, protected, or invite-only). A private publication can be accessed by its URL, so it is different from an unpublished personal script.
Changing the version line alone is not a migration. First compile the original v5 source, then use Convert code to v6 from the editor menu. Fix any conversion errors and compare the chart output. For v4 or earlier, follow each version migration guide in order.
A complete script needs exactly one indicator(), strategy(), or library() declaration. Check that you copied the full source rather than a function or condition fragment. Do not paste a second complete script below the first one.
After adding a personal script that calls log.info(), log.warning(), or log.error(), open Pine logs from the editor More menu. You can also open it from the chart script menu. Published scripts do not generate logs; make a personal copy for debugging.
Related Pine Script Guides & Resources
Pine Script Coding Hub
Language reference, syntax conventions, and debugging guides
Line Continuation Error Fix
How to fix indentation and wrapped line compiler errors
TradingView Indicator Limits
Understand chart capacity and script resource constraints
Visual Pine Script Editor
Point-and-click indicator and strategy development
No-Code Pine Script Builder
Build scripts using visual indicator controls
Create Indicators Without Code
Step-by-step beginner guide to no-code indicator creation