# Pine editor (/platform/charts/pine-editor)



The **Pine editor** is where you inspect scripts generated by [Quant](/platform/quant/introduction), write your own Pine Script®, or paste code you already have. Open it from the **Pine editor** button in the right-hand [panel rail](/platform/workspaces/panels).

## Open and run a script [#open-and-run-a-script]

Click the script name at the top of the editor to open a recent script. To begin another, choose **More actions → New script**. You can work with indicators and strategies; running a strategy also makes its [backtest results](/platform/charts/strategies) available.

Review or edit the code, then click **Run** to execute it on the [active chart](/platform/charts/introduction#the-active-cell). Sign in to run scripts. In a multi-chart workspace, click the intended chart before running.

![Pine editor showing Run, save and version-history controls, and the More actions menu](/images/charts/pine-editor/editor-actions.png)

## Save a script [#save-a-script]

Use **Save** in the editor toolbar, or press **Ctrl+S*&#x2A; on Windows / **⌘S** on Mac while editing. Sign in to keep saved scripts in your account. Scripts you save appear beside Quant-generated scripts in &#x2A;*Indicators → [My Scripts](/platform/charts/indicators#my-scripts)**.

The first save opens a **Save script** dialog where you can confirm the script name. To reopen its saved source later, find the script in **My Scripts** and choose **Open code**.

These actions serve different purposes:

| Action                 | What it keeps or changes                                 |
| ---------------------- | -------------------------------------------------------- |
| **Run**                | Executes the script on the active chart.                 |
| **Save**               | Keeps a reusable script that you can find in My Scripts. |
| **Add to favorites**   | Stars the script so it is easy to find in Favorites.     |
| **Workspace autosave** | Keeps your signed-in chart workspace setup.              |

Use **More actions → Rename** to rename a saved script. If Rename shows **Save first**, save the script before renaming it. **Copy the code** copies the source for use elsewhere or as a separate backup.

### If saving fails [#if-saving-fails]

First copy the code somewhere safe. Check that you are signed in, then try the toolbar’s **Save** action if the keyboard shortcut did not work. If the error continues, contact support with the exact message and whether it happens with this script or with other scripts too.

A failed save does not mean the shortcut is unsupported. Do not close or reload the page until you have preserved any code you need.

## Version history [#version-history]

Open &#x2A;*Version history (this session)** in the editor toolbar to switch between the versions available during the current session.

Selecting an older version loads its code into the editor. Click **Update** to apply that version to the chart. Save it if you want it to become the script’s saved version.

<Warning>
  Version history is local to the current browser session. Reloading the page, leaving the workspace, or ending the session can clear previous versions. Save scripts you want to keep, and copy any older version you need before leaving. Saved scripts and temporary version history are separate.
</Warning>

The version picker switches versions; it does not show a side-by-side code diff.

## Logs and errors [#logs-and-errors]

The **Logs** area at the bottom of the editor shows script messages. Use its collapse control when you need more room for code, and reopen it when investigating execution problems.

If a script fails, inspect the error and the code before running again. [Fix with Quant](/platform/quant/indicators#when-something-breaks) can help repair syntax or runtime errors on supported plans.

## Position the editor [#position-the-editor]

Use **More actions** to change the editor’s docking position, or **Maximize** for more editing space. Close the panel when you want the chart space back, then reopen it from the right-hand rail.

For editor key commands, see [Shortcuts](/platform/charts/shortcuts#pine-editor).
