Skip to main content

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.

LimitValue
Compute per bar50 million instructions
Wall-clock time per bar10 seconds
Memory16 MB
Alerts, orders and plots per bar64
Drawings per bar500
Drawings kept on the chart500 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 source256 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. Use mapGet(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.