Writing your own scripts
The Scripts page is a code editor for your own indicators and strategies. The language follows Pine Script v5 and v6 syntax, so many simple TradingView scripts paste in and run. Every built-in indicator and strategy is a script you can open, read and copy.
What works: variables, var, history like close[1], if and else, for, while, switch, your own functions, tuples, inputs (they become the settings dialog), over 55 ta functions, math, text and colors, plot, hline, fill, bgcolor, barcolor, plotshape, plotchar, plotarrow, plotcandle, arrays, and strategy orders (market, stop, limit, brackets in ticks, trailing stops, close and cancel).
Not yet: drawing objects (label, line, box, table), request.security for other timeframes, libraries and imports, custom types, maps and matrices. Using one gives a clear error that names it.
Times are New York time. time(timeframe.period, "0930-1600") tells you if a bar is inside a session, and session.ismarket means 9:30 to 16:00.
A preview chart runs the script on recent bars while you type and errors show on their line. Saved scripts: Free 3, Pro 25, Elite no limit. Strategies trade only on closed bars and market orders fill at the next bar's open, like on TradingView.