Getting started

Follow this workflow the first time you open the chart code editor.

1. Prerequisites

  1. Connect a broker from the broker panel.
  2. Open a chart pane and load a symbol with candle data.
  3. Click the code icon to open the editor drawer.

2. Run workflow

  1. Edit your script in the editor.
  2. Press Run or Ctrl+Enter.
  3. Change values in the Inputs panel, then Apply & Run.
  4. For AlgoCode scripts, the editor auto-detects //@version=6 and compiles on Run.

3. First indicator (AlgoCode)

//@version=6
indicator("My EMA", overlay=true)

len = input.int(20, "Length", minval=1)
ma = ta.ema(close, len)
plot(ma, color=color.blue, title="EMA")

Paste the script, Run, and you should see a blue EMA line on the price pane. Toggle overlay=true to false to render in a separate oscillator pane.

4. First indicator (JavaScript)

const line = ema(close, 20);
return [plot(line, { color: "#2962ff", title: "EMA 20" })];

JavaScript mode uses the same candle arrays and TA helpers. Always return an array of plot objects.

5. Save & cloud sync

Use the editor save action to store scripts in your account. Saved scripts can be reopened from the script picker and are required before publishing an AlgoCode strategy to algo trading.

6. Alerts

Use the bell icon on a chart pane to create alerts on built-in or custom indicators. AlgoCode alertcondition() and alert() are supported in scripts.

Next steps

Troubleshooting

  • No candle data — connect broker and wait for the chart to load.
  • Compile error — check the console line number; compare with the language reference.
  • Inputs not updating — click Apply & Run after changing the Inputs panel.
Editor documentation opens in a new tab from the status bar Docs link.