Skip to content
ChartDeck ChartScript docs Account Open the terminal

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

CodeSeverityMessage
CS0001errorThe ChartScript compiler is not available.
CS0002errorInternal compiler error: detail

#Syntax

CodeSeverityMessage
CS1001errorThe first line must be //@chartscript 1
CS1002errorChartScript version version is not known to this compiler (newest: max).
CS1003errorThe script must start with indicator(...) or library(...) after the header.
CS1004errorOnly one indicator(...) or library(...) declaration is allowed.
CS1010errorTabs and spaces are mixed in this block's indentation.
CS1011errorUnexpected indentation.
CS1012errorThis line's indentation does not match any open block.
CS1020errorUnexpected character char.
CS1021errorThis string is not closed on the same line.
CS1022errorUnknown escape sequence esc.
CS1023errorThis string is longer than max characters.
CS1024errorA color literal is #RRGGBB or #RRGGBBAA.
CS1025errorThis number is not valid.
CS1026errorNames are at most max characters.
CS1027errorname is reserved and cannot be used as a name.
CS1030errorExpected expected but found found.
CS1031erroropen is not closed.
CS1032errorExpected an expression.
CS1033errorExpected the end of the statement.
CS1034errorExpected a block { … }.
CS1035errorPositional arguments must come before named arguments.
CS1036errorOnly a variable or a field can be assigned to.
CS1037errorExpected => or a block { … } after the parameter list.
CS1038errorToo many errors; the rest of the script was not checked.
CS1040errorThe script is too large: a script can hold up to max KB of code.
CS1041errorExpressions or blocks are nested too deeply (more than max levels).
CS1050errorname is not used in ChartScript: use hint.
CS1051errorreturn can only be the last statement of a function (or of each branch of a final if / switch).
CS1052errorChartScript does not support this form of for loop: use for (let i = a; i < b; i++), for (const x of list) or while.
CS1053errorbreak ends a switch case only as its last statement.
CS1054error++ and -- work only as a statement of their own (i++), not inside an expression.
CS1055errorThis line starts with op: put the operator at the end of the previous line, or wrap the expression in parentheses.
CS1056errorthis can only be used inside a method.
CS1057errorExpected ; or a new line before found.
CS1058errorAn options object { … } can only be the last argument of a call.

#Names, types and qualifiers

CodeSeverityMessage
CS2001errorname is not defined.
CS2002errorname is already declared in this block (line line).
CS2003errorname is a built-in namespace and cannot be used as a name.
CS2004errorname has no member member.
CS2005errorname takes expected arguments, not got.
CS2006errorname has no parameter named param.
CS2007errorThe argument param is given twice.
CS2008errorExpected expected but got got.
CS2009errorname is not a function.
CS2010errorname is not available yet (coming in a later version of ChartScript).
CS2011errorname is not supported in ChartScript.
CS2012errorThis returns got values but expected names are given.
CS2013errorThis call returns no value.
CS2014errorvalue is not one of the allowed values: options.
CS2015hintname works here as hint, the ChartScript keyword with the same meaning.
CS2101errorThe argument param of name must be the same on every bar (needed), but this value is got.
CS2102hintThe length changes from bar to bar, so name keeps max_bars_back (n) values.
CS2103errorThe argument param of name must be a constant.
CS2104errorThe argument param of name must be a constant or an input.
CS2201errorGive name a type, for example: example
CS2203errorComparing with na is always false; use na(name) instead.
CS2204errorA condition cannot be na; write: example
CS2301warningname is the same object on every bar, so name[n] returns the same object.
CS2302errorA history offset must be a whole number of 0 or more.
CS2401errorname is not declared; declare it with decl before assigning to it.
CS2402warningThis declares a new name that hides the one from line line; did you mean to change it with op ?
CS2403errorA function cannot change the global name unless it is declared with kw.
CS2404errorname cannot be changed (it is what).
CS2405errorname is expected; it cannot be given a got value.
CS2501errorname calls itself (through path); recursion is not allowed.
CS2502errorFunctions cannot be declared inside other functions.
CS2503warningname inside a condition only updates on the bars where this line runs. Move it out of the condition for the usual result.
CS2504warningname inside a loop keeps one value per bar: only its last call on each bar counts.
CS2506hinttext divides two whole numbers: the result keeps its fraction. Write int(text) if a whole number was meant.
CS2601errorA field cannot be named name.
CS2602errorA type can have at most max fields.
CS2603errorA method needs the type of the object it works on: example.
CS2604errorA field default must be a constant (field name).
CS2701errorA condition must be a bool, but this is got.
CS2702errorA loop over the items of a list needs an array.
CS2703errorword can only be used inside a loop.
CS2710errorname can only be used at the top level of the script.
CS2711errorThe argument param of name must be a constant.
CS2712errorThis is not a settings condition: use inputs, constants, timeframe.in_seconds(), timeframe.period and market.kind with logic, comparisons, + - * / and ?: (detail).
CS2713errorname has no style property prop.
CS2714errorA check must be a bool, but this is got.
CS2715errorThe preset preset names name, which is not an input of this script.
CS2716errorThe preset preset gives name the value value, which the input does not allow.
CS2717errorThis migration conflicts with another one for name (version since).
CS2718warningThe 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.
CS2719hintNo lang translation for "text".
CS2720errorThe id id is used twice (what).
CS2721errorA script can have at most max what.
CS2722errorThe style property prop does not apply to kind.
CS2723errorThe unit unit does not apply to this input.
CS2724errorThe lower default lo is above the upper default hi.
CS2725errorlook cannot be used on kind.
CS2726errorname is not an input of this script.

#Limits, outputs, requests and alerts

CodeSeverityMessage
CS3001errorA script can have at most max plots.
CS3002errorA script can have at most max inputs.
CS3003errorA script can have at most max alert conditions.
CS3004errorThis script uses n other timeframes or markets; your plan allows max.
CS3005errormax_bars_back must be between min and max.
CS3007errorname can only be used at the top level of the script, not inside a condition, loop or function.
CS3101errorrequest.developing needs a timeframe that is a whole multiple of the chart's, on the same market.
CS3102errorA lower timeframe than the chart is only available through request.lower_tf.
CS3103warningThere are no "tf" bars: the seconds timeframes are 1S, 5S, 10S, 15S, 30S and 45S. This request gives na.
CS3104warningThe market market is not known; its values will be na.
CS3110errorleaf is not known when the tf bar opens; use leaf[1] or atClose.
CS3120errorPlots, inputs, drawings and alerts cannot be used inside a request expression.
CS3121errorA request cannot sit inside another request’s expression.
CS3122warningname 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.
CS3123warningname 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.
CS3124warningname 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).
CS3190warningname returns na in this version: other timeframes and markets arrive in a later version.
CS3201erroralert.on can only be used at the top level of the script.

#Imports and libraries

CodeSeverityMessage
CS4001errorThe library path was not found.
CS4002errorLibraries import each other in a circle: path.
CS4003errorAn exported function cannot use input.*.
CS4004errorThe library path has errors (line line: detail).
CS4005errorexport can only be used in a library.
CS4006errorname is not exported by path.
CS4007errorpath is not a library.
CS4010errorLibraries and imports are not available yet (coming in a later version of ChartScript).

#Runtime

CodeSeverityMessage
CS5001errormessage
CS5101errorIndex index is out of range (size size).
CS5102errorname is na.
CS5103errorA collection can hold at most max elements.
CS5104errorA string can be at most max characters.
CS5105errorA map key cannot be na.
CS5106errorThe matrix sizes do not fit (detail).
CS5107errorname needs a square symmetric matrix in this version.
CS5120errorA script's heatmaps can hold at most max cells: clear old columns (heatmap.clear) or add fewer rows.
CS5121errorA heatmap column can have at most max rows (this one has got).
CS5201errorA history offset cannot be negative or na (got offset).
CS5202errorname[...] reached offset bars back; raise max_bars_back to suggest in indicator().
CS5301errorA loop ran more than max times on one bar.
CS5302warningThe 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.
CS5303errorLoops ran more than max times in total on one bar.
CS5401errorStopped: the script took too long (ms ms; the limit is max ms).
CS5402errorStopped: one live update took too long (ms ms; the limit is max ms).
CS5403errorStopped: the script used more memory than allowed.
CS5404errorStopped: the script stopped answering and was shut down.
CS5501errorInternal runtime error: detail

The ChartScript documentation is in English for now; translations will follow.