//@lipi=N line: N equal to 2 checks the script as Lipi v2, and with no line, or //@lipi=1, it is checked as Lipi v1 (see Moving a script from Lipi v1 to v2).
Three phases
What a check reports
Each problem has a start and an end position (line and column) and a message, and comes in one of two groups.- Errors stop the script. A script with several syntax errors shows only the last one found, and a name or type error usually stops at the first one, so fix what is reported and check again.
- Warnings do not stop the script. Examples:
Unreachable code detected.,opacity 50 is outside 0–1; 1 is solid,Do not use the `na` variable to compare other values to 'na', use the `na()` function instead, andVariable `line` hides the built-in namespace `line`.
h (series float) and b (series bool), the function half(series float a) → series float, the type
P with its field v, and the enum E with its member A. Use it to see what an unfamiliar script declares.
What a clean check does not prove
Rules that apply only when the script is added to the chart
These pass the editor’s check and fail on Add to chart:
A literal
na for an input argument is refused by the editor’s check itself.
format argument of indicator() only accepts format.inherit, format.price, format.volume, or format.percent. Got format.mintick.
Errors that happen while the script runs
The check never executes the script, so it cannot see these:- A history index above 500:
close[501]passes both checks and stops the script with “The script is trying to access historical data outside allowed range (501). The allowed range is 0 to 500.” - An array index outside the array:
array.get(a, 0)on an empty array stops the script (see Arrays). - A
forloop whosesteppoints the wrong way, a drawing text over 999 characters, an array over 10,000 elements. - A script that runs longer than 45 seconds on the chart’s history is cancelled.
- A strategy direction that is not
strategy.longorstrategy.short, such asstrategy.entry("L", "buy"). - Orders and results: a clean check of a strategy runs no bars, so it shows no orders, trades or equity. Add the script to the chart to see them.