Our Pine Script® Editor keeps getting better

Jun 15, 2023

When we introduced our new Editor last year, we told you this would make the introduction of many more features possible, which is exactly what we’ve been doing since then. Let’s go over a few of these new features.

Updating scripts on the chart

When you make changes to the code of a script that is already loaded on the chart, you can now use “Update on chart” instead of “Save”. This allows the on-chart version of the script to update with the new code while increasing only its minor version (version 26.0 will become 26.1) and retaining values in the script’s “Settings” tabs.

The “Update on chart” functionality is implemented as a toggle with the “Add to chart” button. To enable it, select “Update on chart” from the dropdown available next to the “Add to chart” button. Your toggle selection determines what the Editor does when you use the Ctrl+Enter/Cmd+Enter shortcut.

Before using “Update on chart”, your script must be on the chart, and its code must have been changed.

Better console display

We have improved the display of warning and error messages in the console. They now show the time and include a clickable line number that brings the focus on the source of the error in your code. The messages are color-coded: gray for state changes, yellow for warnings, and red for errors.

Editor settings

A new “Editor settings” dialog box available from the “More” menu (the three dots) gives you more control over the Editor’s behavior.

You can now control:

  • Autocomplete
  • The display of the minimap to the right of the editor window
  • The display of a vertical ruler at the 80-character mark
  • Hints shown when using import.

This is just a beginning; we will be adding more options in there.

Improvements for working with imported libraries

Working with libraries has become much easier — you can now import a number of popular and useful libraries with a single button. For now, this works with the following libraries:

  • TradingView/Strategy/3
  • PineCoders/VisibleChart/4
  • PineCoders/Time/3

To import any one of these libraries, just start writing their names and the import string will be added automatically:

Since the libraries are not loaded immediately, new inlay hints have been added to help determine the loading status:

  • “loading…” – while the library is being loaded
  • “as {LibraryName}” if no custom alias is specified — e.g. “as VisibleChart” in the example above
  • When using a custom alias, only “loading…” will be shown during the loading process

To enable line hints, go to the user menu and check the corresponding box:

In addition, the library description can now be seen if you hover over the line where this library is imported:

New indentation logic

Hitting Enter at the end of lines beginning with statements requiring an indented local block will now provide the required indentation on the next line. This applies to the declaration of new functions and types, as well as to conditional and looping structures.

We hope you find these highly-requested features as useful as we think they’ll be, and please do keep sending us your feedback and suggestions so we can make the platform the best it can be. We build TradingView for you, and we’re always keen to hear your thoughts.

Team TradingView

Look first Then leap

TradingView is built for you, so make sure you're getting the most of our awesome features
Launch Chart