Execution budget
Each run ofcompute has a 1000 ms budget. A script that exceeds it is
disabled until you edit it. Keep loops proportional to the number of bars and
avoid rescanning the whole series for every bar.
Synchronous only
Noasync, fetch or timers. compute must return its result directly.
Sandbox
Scripts run isolated from the terminal page. There is nowindow,
document, storage, network access, eval, new Function or import().
Only plain JavaScript built-ins, console and performance.now() are
available. Intl.DateTimeFormat works for time zone math.
Return plain data: numbers, strings, arrays and objects.
No persistence
Nothing is kept between runs. Model “current state” by replaying your rules over the series insidecompute. See the
signal engine example.
Caps
History depth
A script sees the bars the chart has loaded. By default that is about:
Panning back loads more history and re-runs the script.
Not supported
- Restyling the main price series (Pine
plotcandleandbarcolor). - Filling between two plots (Pine
fill). Plot the two boundaries, or draw boxes. - Alerts from scripts (Pine
alertcondition). Price alerts are a separate terminal feature.