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.
| Code | Meaning | What to write |
|---|---|---|
type-mismatch | A value has the wrong type for its place, such as a number where text is expected. | - |
const-required | An 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. |
arity | A call has too few or too many arguments. | Write the call as its signature shows. |
unknown-option | An option, field or key is not one this statement reads. The refusal lists the ones it does. | - |
extra-argument | A positional argument comes after everything the statement reads. The refusal names the accepted form. | - |
missing-argument | A statement or call lacks an argument it needs. | - |
duplicate-option | An option or parameter is written twice. | Write it once. |
duplicate-id | An id or a name is used twice among inputs, series, nodes, plots or bindings. | Give each one its own id. |
option-value | An option or argument has a value outside what it accepts. The refusal lists the accepted values where the set is closed. | - |
input-default | An input default, or a value given for an input, is not valid for its kind or is outside its range. | - |
study-repeated | A script names its study more than once. | Keep one study(...) header. |
expression-form | A bare final expression cannot stand with the statements around it. | Plot the expression, or drop the header. |
clock-shape | A clock is written where the language does not take one. | - |
foreign-construct | A statement is written in another charting language. The refusal names the construct and the way to write it here. | - |
syntax | The 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-shape | A plan is not shaped as the language requires: a missing or unknown field, a wrong container, or ids out of order. | - |
plan-version | A 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-study | A study draws or alerts on nothing. | Add a plot, plotshape, hline, bgcolor, alertcondition or an output word. |
bar-shape | A bar or a bar list is malformed: mixed identities, unordered timestamps or non-finite prices. | - |
limit-inputs | A study declares more inputs than the limit. | - |
limit-series | A study declares more series than the limit. | - |
limit-nodes | A plan has more nodes than the limit. | - |
limit-entries | A plan lists more plots, shapes, lines, fills, backgrounds or alerts than the limit. | - |
limit-depth | Expressions nest deeper than the limit. | - |
limit-functions | A script declares more functions, or inlines functions more often or deeper, than the limit. | - |
limit-script | A script is longer than the limit. | - |
limit-text | A title, label or other text is longer than the limit. | - |
unknown-name | A name is not defined where it is read, or it names something that cannot be read as a value. | - |
named-param-unknown | A named argument is not a parameter of the operator. The refusal lists its parameters. | - |
field-unknown | A bar field name is not one of the nine fields a series carries. | - |
frequency-shape | A frequency is not written as digits and a unit, such as 15m or 1d. | - |
series-empty | A series declaration names neither a symbol nor a timeframe. | - |
series-kind-unavailable | The series kind is not available because nothing serves those bars. | - |
series-unavailable | The run holds no bars for a declared series. The data source has not supplied it. | - |
series-finer-than-chart | A series is finer than the chart, and a study cannot fold a finer series into the chart clock. | - |
series-clock-mismatch | A stateful operator reads series at different frequencies. | Compute on one series first and combine the results. |
feed-undeclared | A feed was supplied for a series the study does not declare. | - |
feed-aliased | A feed was supplied for a series that is bound to the chart bars. | - |
feed-mismatch | The bars in a feed are not those the declaration resolves to. | - |
feed-reset-required | A bar arrived or changed after later chart bars had read it. The study must be reset. | - |
update-shape | An update replaces the latest bar, and there is none, or the bar given is not the latest bar at the same timestamp. | - |
calendar-unavailable | The calendar a chart asked for is not available here. | - |
panel-unknown-table | The study has no table of that name over a list. | - |
duration-needs-calendar | A 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-shape | A duration or clock is not digits followed by one unit. | - |
clock-unsupported-yet | A clock names a calendar or session the language does not have. | - Needs a choice |
value-shape | A value() output is not one expression with an optional label. | - |
label-shape | A label is longer than the limit. | - |
name-shape | A name is not a plain name, is a reserved word, or is already taken by an output or a binding. | - |
limit-shape | A limit is not a whole number in range, written as digits. | - |
sort-shape | A sort is not written as a column with an optional minus sign. | - |
sort-not-column | A sort names a column the table does not have. The refusal lists the columns. | - |
sort-not-ordered | A sort names a column with no order, such as a colour. | - |
where-shape | A where is not one condition that is true or false. | - |
column-needs-name | A column has no heading, a heading that is not a plain name, or no column was written. | Write columns as id=expr. |
column-name-reserved | A column uses a key column name, t or symbol. | - |
table-needs-rows | A table has no row key. | Write over=, rows= or use events(), periods() or screen(). |
table-one-key | A table has two row keys, or an output word was given a row key it already has. | - |
rows-not-a-clock | A period row key is not a calendar clock. | - |
rows-clock-finer | A period is finer than the chart bars, so each row would hold several bars. | - |
calendar-mismatch | A series closes after the row it is read in, so a shown row could change. | - |
flow-needs-agg | A period row reads a flow, such as volume, that has no value at the period close. | - |
output-not-a-value | An output is drawn and never read. A script cannot use its name as a series. | - |
entity-col-unanchored | A 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_limit | A table, a list or an output count is over its limit. The spelling is kept until a later release renames it. Older spelling | - |
study-limit | A study is over a size limit: nodes, window state, or bars held in a run. | - |
set-shape | A list of symbols is not written as a watchlist name or as symbols in brackets. | - |
set-unavailable | A 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-alone | A table over a list is the whole study and cannot share it with another output. | Split it into two studies. |
set-ambiguous | Two lists have the same name. | Rename one so the name is unique. Needs a choice |
set-unresolved | No list has the name written, or no list is active. | - Needs a choice |
set-empty | A list has no symbols this build serves. | - |
set-too-large | A set table reads more members or more data than one study may. | Use a smaller list. Needs a choice |
set-calendar-mixed | A list holds symbols that trade on a calendar the table does not close on. | - Needs a choice |
sets-not-yet | A table over a list runs as a screen of its own. The chart's own lowering does not read it. | - |
table-clock | A table over a list runs on daily bars, and the chart shows another timeframe. | Open the table on a daily chart. |
entity-unknown | A symbol is not served by the data source. The refusal lists the nearest ones. | - Needs a choice |
duplicate-entity | A symbol is written twice in a list and is kept once. | - |
field-shape | A field() statement is not shaped as keys, a cell, an optional label and options. | - |
field-cell-unbound | A cell reads a binder the field keys do not provide. | - |
field-keys-cap | A field has more keys than the limit. | - |
field-prices-not-yet | A field keyed by price waits for that data family. | - |
no-kernel | An operator in the plan cannot be computed by this version. | - |
block-needs-arg | A block has an empty socket that needs an argument. Also a builder code. See it there. | - |
block-socket-type | A block is placed in a socket of another type. Also a builder code. See it there. | - |
scan-body | A 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-arity | The 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-init | The initial value of a scan is not a number or na known before the first bar. | Write a number, na or an input. |
scan-limit | A 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.
| Code | What the line does | What to write instead | Kind |
|---|---|---|---|
convert-parse | The 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-strategy | A 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-drawing | Labels, 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-lookahead | The 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-varip | A 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-unbounded | The 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-collection | Arrays, 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-op | String 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-lookahead | The 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-gaps | The 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-tf | The 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-feed | The 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-length | A 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-state | The 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-color | A 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-dispatch | A 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-series | An 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-offset | A 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-calendar | The 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-month | The 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-offset | A 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-text | Text 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-visual | Candle, 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-nondeterministic | Random 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-meta | Facts 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-call | The function or variable has no equivalent in the converter tables. | Write the calculation with ITMScript operators, or remove the line. | By design |
convert-library | A 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-open | A 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-limit | The 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.
| Code | Meaning | What to write instead |
|---|---|---|
block-socket-type | The 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-arg | The 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-invalid | The edit would leave a study that does not compile. | Read the message, which names the fix, and edit again. |
block-address | The 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-literal | The 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-operator | The 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-placement | The 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-name | The 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-reads | Another 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-order | The 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-tidy | The 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.
| Code | Meaning | What to write |
|---|---|---|
unused-input | An input is declared and never read. | Read the input in the script, or remove it. |
unused-binding | A value is defined and never read by a plot, an output or another value. | Plot or use the value, or remove it. |
plot-constant | A 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-ticker | A 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-na | A 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. |