Resources
Every run has a limit
A script cannot run without limits. This page lists the limits of the engine that runs member scripts and what happens when one is reached.
Design limits, not measurements. These are the values built into the engine at the revision named below. A later revision can change them. They say nothing about how long a script takes.
| Limit | Value | At the limit |
|---|---|---|
| History depth, default | 2,048 bars | Series start at this depth and grow as the script needs. |
| History depth, cap | 8,192 bars | A read past the cap stops the run, or the compile when the number is written in the script. |
| Steps per bar | 500,000 | The run stops on that bar with a named error. Code E-LIMIT-OPS. |
| Steps per run | 600,000,000 | All bars added together, plus work done once for the run. Code E-LIMIT-OPS. |
| Wall clock of an indicator run | 5 seconds | A watchdog stops the run. Code E-LIMIT-TIME. |
| Wall clock of a strategy test | 30 seconds | A watchdog stops the test. Code E-LIMIT-TIME. |
| Logical memory held | 128 MiB | Counted in logical bytes, not host memory. The run stops with a named error. |
| Logical memory built over a run | 2 GiB | Catches loops that build and drop memory again and again. |
| Elements in a collection | 100,000 | An array, map or matrix larger than this stops the run. Code E-LIMIT-ITEMS. |
| Length of a text | 1,000,000 | In characters. Code E-LIMIT-TEXT. |
| Call depth | 64 | Functions called inside one another. Code E-LIMIT-DEPTH. |
| Libraries per script | 64 | Every import counts, including those inside libraries. Code E-IMPORT-COUNT. |
| Symbol and timeframe pairs read | 20 | On a chart. Code E-REQ-LIMIT. |
| Alerts per bar | 20 | Further alerts on the bar are dropped. |
| Source size | 400,000 | In characters. Code E1090. |
| Line length | 20,000 | In characters. Code E1092. |
| Problems reported per compile | 50 | Reporting stops there. Code E2099. |
Where the values come from
Every value is read from the engine's own exporter at engine production@9a82bf9, the revision that serves member scripts (commit of ).
What a stop looks like
A run that reaches a limit stops at the same place each time, with a code, the bar and the line. Nothing is dropped silently. The codes are in the error index.