Docs

ITMScript · Reference

Error codes

Every refusal carries a code that does not change. Look a code up here to read what it means and what to write instead.

The message says what is wrong at the line and column. The code names the reason. A code stays the same when the wording of its message improves, so it is safe to search for. 134 codes are listed in four groups.

Language codes

These come from reading a script, checking it and running it. A code marked Needs a choice has no single rewrite, because the right fix depends on what you want.

CodeMeaningWhat to write
type-mismatchA value has the wrong type for its place, such as a number where text is expected. -
const-requiredAn argument must be known before the first bar: a literal, an input, or arithmetic over them. Write a number, or declare an input and pass it.
arityA call has too few or too many arguments. Write the call as its signature shows.
unknown-optionAn option, field or key is not one this statement reads. The refusal lists the ones it does. -
extra-argumentA positional argument comes after everything the statement reads. The refusal names the accepted form. -
missing-argumentA statement or call lacks an argument it needs. -
duplicate-optionAn option or parameter is written twice. Write it once.
duplicate-idAn id or a name is used twice among inputs, series, nodes, plots or bindings. Give each one its own id.
option-valueAn option or argument has a value outside what it accepts. The refusal lists the accepted values where the set is closed. -
input-defaultAn input default, or a value given for an input, is not valid for its kind or is outside its range. -
study-repeatedA script names its study more than once. Keep one study(...) header.
expression-formA bare final expression cannot stand with the statements around it. Plot the expression, or drop the header.
clock-shapeA clock is written where the language does not take one. -
foreign-constructA statement is written in another charting language. The refusal names the construct and the way to write it here. -
syntaxThe text is not valid ITMScript at this point: a mark is missing or out of place, or a string or character is not allowed. -
plan-shapeA plan is not shaped as the language requires: a missing or unknown field, a wrong container, or ids out of order. -
plan-versionA plan or a script header names a version this version of the language does not read. Open the study again. A version 1 plan is upgraded when it is read.
empty-studyA study draws or alerts on nothing. Add a plot, plotshape, hline, bgcolor, alertcondition or an output word.
bar-shapeA bar or a bar list is malformed: mixed identities, unordered timestamps or non-finite prices. -
limit-inputsA study declares more inputs than the limit. -
limit-seriesA study declares more series than the limit. -
limit-nodesA plan has more nodes than the limit. -
limit-entriesA plan lists more plots, shapes, lines, fills, backgrounds or alerts than the limit. -
limit-depthExpressions nest deeper than the limit. -
limit-functionsA script declares more functions, or inlines functions more often or deeper, than the limit. -
limit-scriptA script is longer than the limit. -
limit-textA title, label or other text is longer than the limit. -
unknown-nameA name is not defined where it is read, or it names something that cannot be read as a value. -
named-param-unknownA named argument is not a parameter of the operator. The refusal lists its parameters. -
field-unknownA bar field name is not one of the nine fields a series carries. -
frequency-shapeA frequency is not written as digits and a unit, such as 15m or 1d. -
series-emptyA series declaration names neither a symbol nor a timeframe. -
series-kind-unavailableThe series kind is not available because nothing serves those bars. -
series-unavailableThe run holds no bars for a declared series. The data source has not supplied it. -
series-finer-than-chartA series is finer than the chart, and a study cannot fold a finer series into the chart clock. -
series-clock-mismatchA stateful operator reads series at different frequencies. Compute on one series first and combine the results.
feed-undeclaredA feed was supplied for a series the study does not declare. -
feed-aliasedA feed was supplied for a series that is bound to the chart bars. -
feed-mismatchThe bars in a feed are not those the declaration resolves to. -
feed-reset-requiredA bar arrived or changed after later chart bars had read it. The study must be reset. -
update-shapeAn update replaces the latest bar, and there is none, or the bar given is not the latest bar at the same timestamp. -
calendar-unavailableThe calendar a chart asked for is not available here. -
panel-unknown-tableThe study has no table of that name over a list. -
duration-needs-calendarA duration is not a bar count. A calendar period of bars is read through a series clock, such as close@1d. Write the window as a number of bars. Needs a choice
duration-shapeA duration or clock is not digits followed by one unit. -
clock-unsupported-yetA clock names a calendar or session the language does not have. - Needs a choice
value-shapeA value() output is not one expression with an optional label. -
label-shapeA label is longer than the limit. -
name-shapeA name is not a plain name, is a reserved word, or is already taken by an output or a binding. -
limit-shapeA limit is not a whole number in range, written as digits. -
sort-shapeA sort is not written as a column with an optional minus sign. -
sort-not-columnA sort names a column the table does not have. The refusal lists the columns. -
sort-not-orderedA sort names a column with no order, such as a colour. -
where-shapeA where is not one condition that is true or false. -
column-needs-nameA column has no heading, a heading that is not a plain name, or no column was written. Write columns as id=expr.
column-name-reservedA column uses a key column name, t or symbol. -
table-needs-rowsA table has no row key. Write over=, rows= or use events(), periods() or screen().
table-one-keyA table has two row keys, or an output word was given a row key it already has. -
rows-not-a-clockA period row key is not a calendar clock. -
rows-clock-finerA period is finer than the chart bars, so each row would hold several bars. -
calendar-mismatchA series closes after the row it is read in, so a shown row could change. -
flow-needs-aggA period row reads a flow, such as volume, that has no value at the period close. -
output-not-a-valueAn output is drawn and never read. A script cannot use its name as a series. -
entity-col-unanchoredA column in a table over a list runs from the first bar it sees, so each symbol would depend on how much history was loaded. Use a window, such as ta.ret(close, 20).
table_limitA table, a list or an output count is over its limit. The spelling is kept until a later release renames it. Older spelling -
study-limitA study is over a size limit: nodes, window state, or bars held in a run. -
set-shapeA list of symbols is not written as a watchlist name or as symbols in brackets. -
set-unavailableA data-backed set, such as an index membership, is not available from the data source. Name a watchlist, or write the symbols. Needs a choice
set-table-aloneA table over a list is the whole study and cannot share it with another output. Split it into two studies.
set-ambiguousTwo lists have the same name. Rename one so the name is unique. Needs a choice
set-unresolvedNo list has the name written, or no list is active. - Needs a choice
set-emptyA list has no symbols this build serves. -
set-too-largeA set table reads more members or more data than one study may. Use a smaller list. Needs a choice
set-calendar-mixedA list holds symbols that trade on a calendar the table does not close on. - Needs a choice
sets-not-yetA table over a list runs as a screen of its own. The chart's own lowering does not read it. -
table-clockA table over a list runs on daily bars, and the chart shows another timeframe. Open the table on a daily chart.
entity-unknownA symbol is not served by the data source. The refusal lists the nearest ones. - Needs a choice
duplicate-entityA symbol is written twice in a list and is kept once. -
field-shapeA field() statement is not shaped as keys, a cell, an optional label and options. -
field-cell-unboundA cell reads a binder the field keys do not provide. -
field-keys-capA field has more keys than the limit. -
field-prices-not-yetA field keyed by price waits for that data family. -
no-kernelAn operator in the plan cannot be computed by this version. -
block-needs-argA block has an empty socket that needs an argument. Also a builder code. See it there.-
block-socket-typeA block is placed in a socket of another type. Also a builder code. See it there.-
scan-bodyA scan body holds something other than its parameters, numbers, arithmetic, comparisons, logic, a select, math functions, nz and na. A window, history, a bar field, a name from outside and another scan are refused. Compute the value outside the scan and pass it in as an input.
scan-arityThe function of a scan does not take one previous value and one parameter per input, a scan has no input or no initial value, or a plan gives the node both a reset word and a reset condition. Declare the function with the previous value first, then one parameter per input.
scan-initThe initial value of a scan is not a number or na known before the first bar. Write a number, na or an input.
scan-limitA scan reads more than 3 inputs, or its body holds more than 48 nodes. Split the work into two scans, or compute part of it outside.

Converter codes

These come from the converter, which reads a Pine Script or thinkScript study and writes ITMScript. A line it cannot convert is refused with one of these codes and the rewrite that would let it through. By design means ITMScript does not do this. Not yet means it may later.

CodeWhat the line doesWhat to write insteadKind
convert-parseThe line could not be read as a statement of the source language.Check the line for a typo, or write it by hand in ITMScript.By design
convert-strategyA strategy places simulated orders. An ITMScript study draws an indicator and never trades.Convert the indicator logic as a study. Mark entries and exits with plotshape or alertcondition.By design
convert-drawingLabels, lines, boxes and tables drawn at chart coordinates have no equivalent. A study produces series and markers.Plot the level as a series with plot or hline. Use value or events for a table of numbers.By design
convert-lookaheadThe script reads a bar that has not closed yet. ITMScript reads history backward only.Read the previous bar with x[1] and accept the one bar delay.By design
convert-varipA varip variable keeps state between ticks inside a bar. The result depends on the tick feed and cannot be reproduced.Compute the value once per bar. Use ta.* operators and x[1] for history.By design
convert-loop-unboundedThe loop has no fixed bound, so its work cannot be limited before it runs.Use a rolling operator with a fixed window, such as ta.sma(x, N) or ta.highest(x, N).By design
convert-collectionArrays, matrices and maps hold state that ITMScript does not model.Use a rolling window over the series. For example ta.highest(x, N) replaces a scan of an array of the last N values.By design
convert-string-opString arithmetic and string comparison are not part of ITMScript. Text is used for titles and labels only.Compare numbers or conditions instead of text. Keep text for titles and labels.By design
convert-security-lookaheadThe request reads a higher timeframe bar before it closes. The value changes after the fact.Declare the series with series(timeframe="1d"). ITMScript reads the last completed bar only.By design
convert-security-gapsThe request leaves gaps between updates of another timeframe. ITMScript repeats the last completed bar instead.Declare the series with series(timeframe=...). It repeats the last completed bar between updates.By design
convert-security-lower-tfThe request asks for bars finer than the chart. A study runs on the chart clock.Run the study on the finer chart and declare the coarser series with series(timeframe=...).By design
convert-request-feedThe request asks for data that is not a price series, such as financials, economic series or earnings.Use a price series declared with series(symbol=...), or enter the value as an input.float.By design
convert-series-lengthA window length that changes from bar to bar cannot size the state of an operator.Use a constant or an input for the length, for example len = input.int(14).By design
convert-stateThe script keeps state between bars in a way a scan cannot hold. A scan has one update, three inputs at most and a short body.Write the recurrence by hand with scan(x, init, f), or use an operator such as ta.ema, ta.cum, latch or hold.Not yet
convert-series-colorA line colour that changes from bar to bar is not supported. A line takes one colour for the whole study.Put the per-bar colour on a plot, a plotshape, a fill or bgcolor, or use one constant colour.Not yet
convert-dispatchA choice input is used as a value, and a choice has no value in a calculation. A choice compares with one of its own options, and the comparison picks a value with ?:.Write the choice as a chain of comparisons, such as kind == "ema" ? ta.ema(close, len) : ta.sma(close, len), or keep one version of the study per choice.Not yet
convert-input-seriesAn input that chooses a timeframe or a symbol can only feed a series declaration. Here it is read as a value in a calculation, names the symbol a price is read on, or picks the period a running total restarts on.Declare a series with the input, for example d = series(timeframe=tf), and read d.close, or write the symbol, the timeframe or the period as quoted text.Not yet
convert-plot-offsetA plot shifts ahead by a whole number of bars from 0 to 500, written in the call or given by an int input and arithmetic over int inputs. A shift backward draws a later bar's value on an earlier bar, which this language cannot draw, and a shift on any output but plot is not carried.Write the shift as a number or an int input on the plot. For a value from n bars ago, read it with x[n]. A plot shifted back has no form.By design
convert-calendarThe script reads the chart's own timeframe as a value, a session written as text, a time input or a calendar function with no ITMScript form.Use a calendar field such as hour or session.ismarket, a reset= word, or one study for each timeframe.Not yet
convert-frequency-monthThe script names a frequency that has no series clock here.Declare the series at a daily, weekly, monthly, quarterly or yearly frequency.Not yet
convert-dynamic-offsetA history offset that changes from bar to bar cannot be bounded before the run.Use a constant or an input for the offset, for example x[len] with len = input.int(5).By design
convert-dynamic-textText built from values at run time, such as a label that shows a price, is not supported.Plot the number. Use value for a single readout.By design
convert-host-visualCandle, bar and price colouring replace the drawing of the chart itself. A study adds series and markers on top of it.Use plotshape markers, or tint the background with bgcolor.By design
convert-nondeterministicRandom numbers, the wall clock and other values that differ between runs break reproducibility.Remove the value, or replace it with a fixed input.By design
convert-instrument-metaFacts about the instrument, such as tick size, point value or currency, are not available to a study.Enter the value as an input.float and set it for the instrument.By design
convert-unknown-callThe function or variable has no equivalent in the converter tables.Write the calculation with ITMScript operators, or remove the line.By design
convert-libraryA library declaration or an import brings code from another script.Paste the library's functions into the script, or write them as functions.By design
convert-period-openA period's own open, high, low or close read without an offset is the forming period's value, which this language cannot state exactly on this chart.Read the closed period with a shift of one, for example d.close[1].By design
convert-limitThe script is larger or more deeply nested than the converter accepts.Split the script into smaller studies and convert each one.By design

Builder codes

These come from the block editor in the builder. An edit it refuses carries one of them, and an edit the language refuses carries the language's code inside a block-invalid refusal.

CodeMeaningWhat to write instead
block-socket-typeThe block does not fit the socket it was dropped on. Also a language code. See it there.Drop a block of the type the socket shows, or wrap this one so its type matches.
block-needs-argThe operator needs a value for one of its parameters and the catalog has no default for it. Also a language code. See it there.Pass a value for the named parameter, or write the call as text.
block-invalidThe edit would leave a study that does not compile. Read the message, which names the fix, and edit again.
block-addressThe address names no socket in this study, or the edit needs a position in the text that is not known. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Pick a socket the blocks show, or write the change as text.
block-literalThe socket does not hold a literal, so a value cannot be set on it. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Replace the block with a literal block first, or write the change as text.
block-operatorThe operator is not in the catalog. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Pick an operator from the palette.
block-placementThe block cannot go there, or the socket cannot be left empty. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Replace the block instead of removing it, or write the change as text.
block-nameThe name cannot be used for a binding. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Use letters, digits and underscores, starting with a letter, and pick a name no other binding has.
block-readsAnother statement reads this one, so it cannot be taken out. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Remove or change the statements that read it first, or write the change as text.
block-orderThe edit leaves a name read above the line that defines it. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Keep every name above the lines that read it, or write the change as text.
block-tidyThe text gives no single place for this edit. A block-invalid refusal gives this code as its reason when the block editor refused the edit. Tidy the script into blocks, which writes it out in plain form with its names kept, then make the edit again.

Warnings

A warning is not a refusal. The script compiles and the study runs. The builder lists the warnings of a good script under the editor, each with its line and column. A warning never stops a study.

CodeMeaningWhat to write
unused-inputAn input is declared and never read.Read the input in the script, or remove it.
unused-bindingA value is defined and never read by a plot, an output or another value.Plot or use the value, or remove it.
plot-constantA plot draws a constant that no fill reads. An hline draws a level without a series.Use hline for a level, or name the plot in a fill.
shadowed-tickerA value's name is a ticker, so the ticker's own fields are hidden behind it in this script.Give the value a name that is not a ticker.
compare-naA comparison with na is never true. na(x) tests for a missing value.Write na(x) for an equals test, or not na(x) for a differs test.