TradingView enhances its Pine Script Editor
TradingView has enhanced its Pine Script Editor, adding a number of new functionalities.
- 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
TradingView has 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.
- 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.
- 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.