Error messages
Every message the ChartScript compiler and runtime can show, with what it means and how to fix it. In the editor, each entry of the Problems tab links to its page.
#Internal
| Code | Severity | Message |
|---|---|---|
CS0001 | error | The ChartScript compiler is not available. |
CS0002 | error | Internal compiler error: detail |
#Syntax
| Code | Severity | Message |
|---|---|---|
CS1001 | error | The first line must be //@chartscript 1 |
CS1002 | error | ChartScript version version is not known to this compiler (newest: max). |
CS1003 | error | The script must start with indicator(...) or library(...) after the header. |
CS1004 | error | Only one indicator(...) or library(...) declaration is allowed. |
CS1010 | error | Tabs and spaces are mixed in this block's indentation. |
CS1011 | error | Unexpected indentation. |
CS1012 | error | This line's indentation does not match any open block. |
CS1020 | error | Unexpected character char. |
CS1021 | error | This string is not closed on the same line. |
CS1022 | error | Unknown escape sequence esc. |
CS1023 | error | This string is longer than max characters. |
CS1024 | error | A color literal is #RRGGBB or #RRGGBBAA. |
CS1025 | error | This number is not valid. |
CS1026 | error | Names are at most max characters. |
CS1027 | error | name is reserved and cannot be used as a name. |
CS1030 | error | Expected expected but found found. |
CS1031 | error | open is not closed. |
CS1032 | error | Expected an expression. |
CS1033 | error | Expected the end of the statement. |
CS1034 | error | Expected a block { … }. |
CS1035 | error | Positional arguments must come before named arguments. |
CS1036 | error | Only a variable or a field can be assigned to. |
CS1037 | error | Expected => or a block { … } after the parameter list. |
CS1038 | error | Too many errors; the rest of the script was not checked. |
CS1040 | error | The script is too large: a script can hold up to max KB of code. |
CS1041 | error | Expressions or blocks are nested too deeply (more than max levels). |
CS1050 | error | name is not used in ChartScript: use hint. |
CS1051 | error | return can only be the last statement of a function (or of each branch of a final if / switch). |
CS1052 | error | ChartScript does not support this form of for loop: use for (let i = a; i < b; i++), for (const x of list) or while. |
CS1053 | error | break ends a switch case only as its last statement. |
CS1054 | error | ++ and -- work only as a statement of their own (i++), not inside an expression. |
CS1055 | error | This line starts with op: put the operator at the end of the previous line, or wrap the expression in parentheses. |
CS1056 | error | this can only be used inside a method. |
CS1057 | error | Expected ; or a new line before found. |
CS1058 | error | An options object { … } can only be the last argument of a call. |
#Names, types and qualifiers
| Code | Severity | Message |
|---|---|---|
CS2001 | error | name is not defined. |
CS2002 | error | name is already declared in this block (line line). |
CS2003 | error | name is a built-in namespace and cannot be used as a name. |
CS2004 | error | name has no member member. |
CS2005 | error | name takes expected arguments, not got. |
CS2006 | error | name has no parameter named param. |
CS2007 | error | The argument param is given twice. |
CS2008 | error | Expected expected but got got. |
CS2009 | error | name is not a function. |
CS2010 | error | name is not available yet (coming in a later version of ChartScript). |
CS2011 | error | name is not supported in ChartScript. |
CS2012 | error | This returns got values but expected names are given. |
CS2013 | error | This call returns no value. |
CS2014 | error | value is not one of the allowed values: options. |
CS2015 | hint | name works here as hint, the ChartScript keyword with the same meaning. |
CS2101 | error | The argument param of name must be the same on every bar (needed), but this value is got. |
CS2102 | hint | The length changes from bar to bar, so name keeps max_bars_back (n) values. |
CS2103 | error | The argument param of name must be a constant. |
CS2104 | error | The argument param of name must be a constant or an input. |
CS2201 | error | Give name a type, for example: example |
CS2203 | error | Comparing with na is always false; use na(name) instead. |
CS2204 | error | A condition cannot be na; write: example |
CS2301 | warning | name is the same object on every bar, so name[n] returns the same object. |
CS2302 | error | A history offset must be a whole number of 0 or more. |
CS2401 | error | name is not declared; declare it with decl before assigning to it. |
CS2402 | warning | This declares a new name that hides the one from line line; did you mean to change it with op ? |
CS2403 | error | A function cannot change the global name unless it is declared with kw. |
CS2404 | error | name cannot be changed (it is what). |
CS2405 | error | name is expected; it cannot be given a got value. |
CS2501 | error | name calls itself (through path); recursion is not allowed. |
CS2502 | error | Functions cannot be declared inside other functions. |
CS2503 | warning | name inside a condition only updates on the bars where this line runs. Move it out of the condition for the usual result. |
CS2504 | warning | name inside a loop keeps one value per bar: only its last call on each bar counts. |
CS2506 | hint | text divides two whole numbers: the result keeps its fraction. Write int(text) if a whole number was meant. |
CS2601 | error | A field cannot be named name. |
CS2602 | error | A type can have at most max fields. |
CS2603 | error | A method needs the type of the object it works on: example. |
CS2604 | error | A field default must be a constant (field name). |
CS2701 | error | A condition must be a bool, but this is got. |
CS2702 | error | A loop over the items of a list needs an array. |
CS2703 | error | word can only be used inside a loop. |
CS2710 | error | name can only be used at the top level of the script. |
CS2711 | error | The argument param of name must be a constant. |
CS2712 | error | This is not a settings condition: use inputs, constants, timeframe.in_seconds(), timeframe.period and market.kind with logic, comparisons, + - * / and ?: (detail). |
CS2713 | error | name has no style property prop. |
CS2714 | error | A check must be a bool, but this is got. |
CS2715 | error | The preset preset names name, which is not an input of this script. |
CS2716 | error | The preset preset gives name the value value, which the input does not allow. |
CS2717 | error | This migration conflicts with another one for name (version since). |
CS2718 | warning | The id of what changed from was to now since the previous version; saved styles for it will be lost. Give it the id "was" again to keep them. |
CS2719 | hint | No lang translation for "text". |
CS2720 | error | The id id is used twice (what). |
CS2721 | error | A script can have at most max what. |
CS2722 | error | The style property prop does not apply to kind. |
CS2723 | error | The unit unit does not apply to this input. |
CS2724 | error | The lower default lo is above the upper default hi. |
CS2725 | error | look cannot be used on kind. |
CS2726 | error | name is not an input of this script. |
#Limits, outputs, requests and alerts
| Code | Severity | Message |
|---|---|---|
CS3001 | error | A script can have at most max plots. |
CS3002 | error | A script can have at most max inputs. |
CS3003 | error | A script can have at most max alert conditions. |
CS3004 | error | This script uses n other timeframes or markets; your plan allows max. |
CS3005 | error | max_bars_back must be between min and max. |
CS3007 | error | name can only be used at the top level of the script, not inside a condition, loop or function. |
CS3101 | error | request.developing needs a timeframe that is a whole multiple of the chart's, on the same market. |
CS3102 | error | A lower timeframe than the chart is only available through request.lower_tf. |
CS3103 | warning | There are no "tf" bars: the seconds timeframes are 1S, 5S, 10S, 15S, 30S and 45S. This request gives na. |
CS3104 | warning | The market market is not known; its values will be na. |
CS3110 | error | leaf is not known when the tf bar opens; use leaf[1] or atClose. |
CS3120 | error | Plots, inputs, drawings and alerts cannot be used inside a request expression. |
CS3121 | error | A request cannot sit inside another request’s expression. |
CS3122 | warning | name changes on the chart bars (how), so a request cannot recompute it on the requested bars: there it is na (kw) or the chart’s current value. Compute it in a function called inside the request. |
CS3123 | warning | name belongs to the code around this request; the request expression runs on other bars and reads it as na. Pass a market / timeframe instead, or compute the value inside the request. |
CS3124 | warning | name is ChartDeck data of the chart’s own market: inside a request expression it reads na. Read it outside the request (its value is already aligned to the chart’s bars). |
CS3190 | warning | name returns na in this version: other timeframes and markets arrive in a later version. |
CS3201 | error | alert.on can only be used at the top level of the script. |
#Imports and libraries
| Code | Severity | Message |
|---|---|---|
CS4001 | error | The library path was not found. |
CS4002 | error | Libraries import each other in a circle: path. |
CS4003 | error | An exported function cannot use input.*. |
CS4004 | error | The library path has errors (line line: detail). |
CS4005 | error | export can only be used in a library. |
CS4006 | error | name is not exported by path. |
CS4007 | error | path is not a library. |
CS4010 | error | Libraries and imports are not available yet (coming in a later version of ChartScript). |
#Runtime
| Code | Severity | Message |
|---|---|---|
CS5001 | error | message |
CS5101 | error | Index index is out of range (size size). |
CS5102 | error | name is na. |
CS5103 | error | A collection can hold at most max elements. |
CS5104 | error | A string can be at most max characters. |
CS5105 | error | A map key cannot be na. |
CS5106 | error | The matrix sizes do not fit (detail). |
CS5107 | error | name needs a square symmetric matrix in this version. |
CS5120 | error | A script's heatmaps can hold at most max cells: clear old columns (heatmap.clear) or add fewer rows. |
CS5121 | error | A heatmap column can have at most max rows (this one has got). |
CS5201 | error | A history offset cannot be negative or na (got offset). |
CS5202 | error | name[...] reached offset bars back; raise max_bars_back to suggest in indicator(). |
CS5301 | error | A loop ran more than max times on one bar. |
CS5302 | warning | The array is changed inside the loop that goes through it; the loop goes on with its new size. An index loop says that more clearly. |
CS5303 | error | Loops ran more than max times in total on one bar. |
CS5401 | error | Stopped: the script took too long (ms ms; the limit is max ms). |
CS5402 | error | Stopped: one live update took too long (ms ms; the limit is max ms). |
CS5403 | error | Stopped: the script used more memory than allowed. |
CS5404 | error | Stopped: the script stopped answering and was shut down. |
CS5501 | error | Internal runtime error: detail |