The **Script Editor** (`EDIT`) lets you write your own indicators and strategies in TypeScript or Pine Script. Scripts run in your browser on the linked security's daily bars. You can plot them on the chart, backtest strategies, keep versions, and publish them to the Roxom script store.

  <video controls className="w-full aspect-video" src="/images/help-center/roxom-pro/videos/19-scripts.mp4">

## The editor

Type `EDIT` and press <kbd>ENTER. The window has three parts:

- **Left sidebar:** **TEMPLATES** to start from (for example *MA Cross*, *RSI*, *EMA Ribbon* and *RSI Reversion (strategy)*) and **MY SCRIPTS**, your saved scripts.
- **Toolbar:** **▶ RUN**, the visibility (**PRIVATE**, **PUBLIC · HIDDEN SOURCE** or **PUBLIC · OPEN SOURCE**), **SAVE**, **PUBLISH…**, **SHARE** and **ON CHART**. It also shows the security and timeframe the script runs on (for example `STRC 1D`).
- **Code** in the middle, and a bottom panel with tabs: **CONSOLE**, **TESTER**, **INFO**, **VERSIONS**, **LIBRARY** and **AI**.

## How to write and run an indicator

**Start from a template**

    Select a template under **TEMPLATES**, for example **MA Cross**. Its code opens in the editor.

**Edit the code**

    Inputs are declared with `input.*` (for example `input.int("Fast length", 9)`), calculations use `ta.*` (for example `ta.ema`, `ta.crossover`), and output uses `plot.*`. Use `alertcondition(...)` to define conditions you can alert on.

**Run it**

    Select **▶ RUN** or press <kbd>⌘/<kbd>Ctrl + <kbd>ENTER. Output and any `console.log` appear in **CONSOLE**.

**Show it on the chart**

    Select **ON CHART** to draw the script on the linked chart (`GP`).

**Save it**

    Select **SAVE**. The script appears under **MY SCRIPTS**, and each save is kept in **VERSIONS**, so you can roll back.

## Backtest a strategy

Strategies (scripts that place simulated entries and exits, like the *RSI Reversion (strategy)* template) can be backtested. Run the script and open the **TESTER** tab to see the trades with their side, entry and exit, the equity curve against buy and hold, and summary statistics. Select **EXPORT CSV** to download the trades.

## Write a script with AI

Open the **AI** tab, describe the indicator or strategy you want, and select **WRITE IT**. The generated code opens in the editor for you to review and run.

## Library and sharing

- **LIBRARY** lists public scripts by other users, sorted by **MOST USED** or **NEWEST**, with **Categories** and **Search scripts**. **OPEN** a script to read it, **INSTALL** it to use it, **FORK** an open-source script to make your own copy, or **RATE** and **REPORT** it.
- **PUBLISH…** shares your script in the store. Choose **PUBLIC · OPEN SOURCE** to show your code, or **PUBLIC · HIDDEN SOURCE** to let people use it without seeing the code.
- **SHARE** copies a link to the script's public page.

Scripts you write run only in your browser. A hidden-source script from someone else runs on Roxom's servers, so its code never reaches your browser.

## Related articles

EDIT: Script Editor

GP: Chart
