Limits
Every script runs in a sandbox with a fixed budget per bar. Exceeding a limit stops the script with an error that names the limit.
| Limit | Value |
|---|---|
| Compute per bar | 50 million instructions |
| Wall-clock time per bar | 10 seconds |
| Memory | 16 MB |
| Alerts, orders and plots per bar | 64 |
| Drawings per bar | 500 |
| Drawings kept on the chart | 500 per kind, oldest removed first |
Indicator call sites and series() | 256 |
Higher timeframes and other symbols (request.timeframe, request.security) | 5 contexts, 3 other symbols, at most 1 day and 500 times the chart timeframe |
| Script source | 256 KB |
A script that stops is not restarted automatically. Fix the cause and reload it.
Common causes
- An indicator length that changes every bar. Each new length creates a new indicator. Keep lengths constant or derived from inputs.
- Reading a missing map key.
m.get(key)stops the script if the key is absent. UsemapGet(m, key). - Drawing without an id on every tick. Give drawings that follow price an id, so they are updated instead of added.
- An unguarded array index or division. Check bounds and zero denominators.