Skip to main content
Most limits are met while the script runs, so a script can pass every check and then stop on a bar. Only the title limit and the talib.ema window (see Messages) are checked earlier.

Messages

  • History: The script is trying to access historical data outside allowed range (501). The allowed range is 0 to 500. close[501] compiles and then stops; so does talib.sma(close, 600), with the length in the brackets. talib.ema, macd, bbw, kc and kcw refuse such a length already when the script is added to the chart.
  • Arrays: Array size exceeds the maximum allowed length of 10000 (requested 10001). A static array grows on every bar unless you trim it. array.from with too many arguments stops with Error in array.from(): too many arguments: 4001 (max 4000).
  • Polylines: a points array of more than 1000 (or none) makes polyline.new return na, with no error; keep the array at or under 1000 points.
  • Text: String is too long (1000 characters). Maximum length is 999. A long literal still compiles.
  • Title: String is too long (130 characters). Maximum length is 128. Only indicator() checks its title.
  • Strategies: Maximum number of open trades (1000) exceeded. Maximum number of pending orders (3000) exceeded. Older closed trades return na from the strategy.closedtrades_* functions.
  • Time: Execution cancelled, after 45 seconds. Loops have no iteration cap; this limit is the only stop.

Drawings and tables

Set the limit per kind with max_lines_count, max_labels_count, max_boxes_count or max_polylines_count on indicator() or strategy() (constant integers). A larger value is clamped without an error; zero or less gives 50. Linefills are fixed at 50. Going over is not an error: the oldest drawings of the kind are deleted down to the limit, except those a static variable holds directly (see Lines, labels, boxes and polylines). A table occupies its position.* slot: a new table there replaces the old one.

Not limited

The compiler sets no limit on script length or on the number of variables, inputs or plots.