> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Limits and determinism

> The limits every script runs within, the same on every device and plan, and why its results are the same everywhere.

Know the limits a script runs within. They are the same on every device and every plan.

| Limit | Value |
| - | - |
| Steps (loop iterations and function calls) | 10 million for setup, per batch of 512 bars, and per live update |
| Plots | 64 |
| Series lookback | 5,000 bars |
| `tallyBy` keys | 10,000 |
| State lists and maps | 100,000 entries |
| Drawings | 50 per kind by default, 500 at most |
| Tables | 9 |
| Labels and table cells | 500 characters |
| A single run | 5 seconds |

Past the step budget a script stops with `OX2200`, naming the line of the loop or call, and keeps what it had drawn. Counting steps rather than time makes the limit behave the same on a phone and a desktop. A run that takes more than 5 seconds is stopped, and the same script with the same settings is not loaded again on the page until you change it.

## Keeping a script fast

* Work per bar, not per bar times history: keep running totals in [state](/terminal/guides/state) rather than looping back over old bars.
* Draw only on the newest bar (`chart.isLast`) when only the newest bar's drawing matters.
* Sum events into tallies in their handlers; do the per-bar work once in `onBar` or `onClose`.

## The same result everywhere

A script gives the same output for the same data in every browser:

* no clock, timers or `Math.random`: `random(seed)` gives the same numbers for the same seed;
* `Math` is the engine's own, a port of fdlibm, so `exp`, `log`, `pow` and the trigonometric functions give the same bits in Chrome, Safari and Firefox;
* `ta.*` follow TradingView's formulas, seeds and running sums.

Scripts run in a worker of their own, served with a policy that allows no network access, and output is checked against the script's declaration before it is drawn.

## Next step

Check scripts outside the terminal, or have an AI write them, with [tools for agents](/terminal/guides/agents).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.