Write a script, see it on a live chart, keep it in your account.
Open the editor
Open any chart, then the Indicators menu. Under Scripts, pick New script, or Edit in the Pine Editor on a saved script. The editor docks under the chart, so you write and watch the result side by side.
Or go straight to the Pine Editor. On a phone, it opens as a sheet with a Chart and Editor switch.
Write your first script
Open the Open menu and pick New indicator. Every script starts with a version line and a declaration, then the code that runs on each bar.
//@version=6
indicator("Two averages", overlay = true)
fastLen = input.int(9, "Fast length", minval = 1)
slowLen = input.int(21, "Slow length", minval = 1)
fast = ta.ema(close, fastLen)
slow = ta.ema(close, slowLen)
plot(fast, "Fast", color = color.teal)
plot(slow, "Slow", color = color.orange, linewidth = 2)
plotshape(ta.crossover(fast, slow), "Cross up", shape.triangleup, location.belowbar, color.teal)Scripts run once per bar, from the oldest bar to the newest. Names like close and volume always hold the current bar's value.
Compile as you type
The editor checks your code a moment after you stop typing. Problems show as squiggles in the code and as lines in the Problems list.
Error at 5:22 Undeclared identifier 'fastlen'means a name is misspelled or not defined yet.- Click a problem to jump to it.
Add it to the chart
Click Add to chart, or press Cmd+Enter on a Mac and Ctrl+Enter elsewhere. After the first time, the button reads Update on chart.
Change an input in the script, update, and the chart redraws. If part of the script shows nothing on Sidechair yet, a warning says which part.
Save your work
Press Cmd+S or Ctrl+S. Signed in, your scripts sync to your account and appear under Open on any device. Signed out, they stay in this browser. You can keep up to 20 scripts.
Where to go next
- The functions index lists every built-in, grouped by namespace.
- Each function page has its arguments, return value and a script you can run.
- Porting a script from TradingView? Read the porting guide first.