Black Friday 30% off Basic and ProBlack Friday −30%Ends in––d––h––m––sSee the deal

Errors and recalculation

Where errors show up, when the indicator recalculates and what the limits are.

Two kinds of error

ErrorExamplesWhere it shows
Compile errorSyntax, a construct that isn’t allowed, a name that doesn’t exist, a wrong argument in a declarationIn the editor, on the line, and in the console
During the calculationA division by zero, an index out of the list, a raise ValueErrorIn the Log tab, with the line; in the legend only “Script error”: the indicator doesn’t draw

Compile errors show up when you save: the compiler checks the whole script, even the lines that wouldn’t run. The messages are in Italian and say what was expected, like Nelle dichiarazioni si scrivono solo valori, non calcoli or Le candele non hanno il campo closes.

Python
if length < 2:
    raise ValueError("Length must be at least 2")

With raise ValueError(…) you stop the calculation with your own message, which appears in the legend.

When it recalculates

  • When data or settings change: a new or updated candle, a page of history, a new news event or data just released, an input, the chart’s timeframe. Never when scrolling or zooming.
  • Each calculation redoes everything, from the first candle: that’s why the function receives the whole series. In real time each tick restarts the calculation, and the indicator lags by at most one calculation.
  • While data is arriving, candles or news, the legend shows a spinning circle and the previous values remain.

Timed out

A full calculation has 5 seconds: beyond that, it stops with “Timed out”, and the other indicators carry on. Once stopped it doesn’t download more data, not even when you move the chart: “Reload” in the legend’s More menu restarts it, after the other errors too. If the calculation is slow, reduce the candles with max_bars or avoid loops inside loops over all candles.

Limits

LimitValue
Code size200 KB
Name of a script or a publication40 characters
Description of a publication500 characters
Inputs32
Plots32
Drawings per indicator500, up to 10,000 with max_drawings
Candles after the latest, for drawing points500
print lines per calculation1000
Distinct requests, request.bars and request.events8
Candles per calculation, for each request200,000 if max_bars is missing
Time for a full calculation5 seconds