Diagnostics
Stable compiler diagnostic codes of Flowscope Script, each with a failing and a corrected example.
Every message the compiler reports carries a stable code. The letter names the stage that found the problem; the number never changes meaning, so you can search for it, link to it and silence nothing by accident. Errors stop the script from running; warnings point at code that runs but probably does not do what you meant.
Parse (P…)
Problems found while reading the source text: characters, literals, line structure and syntax forms that Flowscope Script does not have.
| Code | Severity | Summary |
|---|---|---|
| P001 | error | unrecognized token |
| P002 | error | unterminated string literal |
| P003 | error | semicolon is not supported |
| P004 | error | word spelling of a logical operator |
| P005 | error | ?? mixed with && or || needs parentheses |
| P006 | error | while is not supported |
| P007 | error | template strings are not supported |
| P008 | error | ?. is not supported |
| P009 | error | postfix ! is not supported |
| P011 | error | top-level statement is not a declaration |
| P014 | error | break and continue are not statements |
| P016 | error | expected token |
| P021 | error | invalid color literal |
| P022 | error | unknown string escape |
| P023 | error | match arm in statement form needs a block |
| P024 | error | match expression arm takes an expression, not a block |
| P025 | error | keyword used as a name |
| P026 | error | ternary broken before ? or : |
| P027 | error | second statement on the same line |
Setup and declarations (S…)
Declarations that cannot be evaluated before the first bar, misuse of setup-only constructors, subscription arguments and alert declarations.
| Code | Severity | Summary |
|---|---|---|
| S001 | error | live value used in setup |
| S002 | error | built-in cannot run in setup |
| S005 | error | collection capacity must be known before the script runs |
| S006 | error | duplicate panel name |
| S007 | error | constructor does not fit the declaration keyword |
| S008 | error | user function called in setup |
| S011 | error | setup value reads a later declaration |
| S012 | error | empty exchange list in subscription |
| S013 | error | color scale needs matching lists with at least two entries |
| S015 | error | minimum trade size must be positive and finite |
| S018 | error | lambda or collection transform in setup |
| S019 | error | alert constructor outside an alert declaration |
| S020 | error | invalid alert payload type |
| S022 | error | trigger argument does not match the alert payload |
| S026 | error | subscription history cannot be negative |
| S027 | error | the chart subscription cannot be live only |
Types and names (T…)
Name resolution and type checking. T0xx names and declarations, T1xx types and literals, T2xx calls, arguments and returns, T3xx user types and match, T4xx handlers, series, plots and lambdas.
| Code | Severity | Summary |
|---|---|---|
| T001 | error | unknown identifier |
| T002 | error | duplicate top-level name |
| T005 | error | unknown type name |
| T006 | error | local hides a built-in namespace |
| T007 | error | name is already bound in this scope |
| T010 | error | script header missing or misplaced |
| T011 | warning | duplicate display title |
| T013 | warning | unused binding |
| T014 | warning | unused subscription |
| T016 | error | duplicate input key |
| T101 | error | type mismatch |
| T102 | error | operator not defined for these operand types |
| T103 | error | float needs an explicit conversion to int |
| T106 | error | invalid map key type |
| T109 | error | type is not indexable |
| T111 | error | invalid timeframe literal |
| T112 | error | zero-length timeframe |
| T113 | error | integer literal out of range |
| T114 | error | invalid session literal |
| T201 | error | unknown named argument |
| T202 | error | positional argument after a named one |
| T203 | error | argument supplied more than once |
| T204 | error | missing argument |
| T205 | error | too many positional values |
| T206 | error | parameter default is not a literal |
| T207 | error | required parameter after an optional one |
| T208 | error | null default for a non-nullable parameter |
| T211 | error | wrong number of return values |
| T212 | error | not every path returns a value |
| T214 | error | destructuring does not match the returned values |
| T215 | error | no overload matches these arguments |
| T216 | error | value cannot be reassigned |
| T217 | error | invalid assignment target |
| T301 | error | type field has no type annotation |
| T302 | error | type contains itself |
| T303 | error | type name is not UpperCamelCase |
| T304 | error | match does not cover every case |
| T305 | warning | null arm on a value that cannot be null |
| T306 | error | record literal has wrong fields |
| T307 | error | duplicate field in a type |
| T401 | error | function calls itself |
| T402 | error | stateful calculation inside a loop |
| T403 | error | indicator inputs come from different timeframes |
| T405 | error | event not available for this subscription |
| T406 | error | duplicate handler |
| T407 | error | handler on a snapshot source |
| T408 | error | indicator on a calendar timeframe |
| T413 | error | indicator length must be known before the script runs |
| T414 | error | indicator length out of range |
| T415 | error | plot method does not match the panel |
| T416 | error | invalid str.format template |
| T420 | error | trade fields are read-only |
| T422 | error | book or profile view kept beyond the current call |
| T425 | error | fill has both a solid color and a gradient |
| T426 | error | lambda in an invalid position or with a block body |
| T427 | error | invalid lambda parameter list |
| T428 | error | stateful call, randomness or drawing inside a lambda |
| T430 | error | collection transform must be its own statement |
| T442 | error | record literal without a type name |
| T449 | warning | isLast read in a close handler |
Null safety (N…)
Places where a value that may be missing is used as if it were always present.
| Code | Severity | Summary |
|---|---|---|
| N001 | error | value may be null here |
| N002 | error | null check on a field does not narrow it |
| N003 | error | null needs an explicit type |
Collections (C…)
Arrays, rolling buffers and maps: read-only setup data, element types, capacities and subscription series.
| Code | Severity | Summary |
|---|---|---|
| C001 | error | setup collection is read-only |
| C003 | error | collection cannot contain another collection |
| C004 | error | key is missing from a setup map |
| C005 | error | empty array needs a capacity |
| C006 | error | subscription series is read-only |
Limits (L…)
Fixed resource limits per script: stateful calls, subscriptions, capacities, inputs, plots and alerts.
| Code | Severity | Summary |
|---|---|---|
| L001 | error | too many stateful call sites |
| L006 | error | too many subscriptions |
| L007 | error | capacity exceeds the supported limit |
| L008 | error | negative capacity |
| L010 | error | too many inputs |
| L011 | error | too many plots |
| L013 | error | too many alerts |
| L015 | error | expressions or blocks nest too deeply |
Backtesting and strategies (B…)
The strategy declaration, order functions and broker emulator settings used by the Strategy Tester.
| Code | Severity | Summary |
|---|---|---|
| B001 | error | strategy order outside a handler |
| B002 | error | strategy function without a strategy declaration |
| B003 | error | more than one strategy declaration |
| B004 | error | strategy property set twice |
| B005 | warning | exit refers to an unknown entry id |
| B006 | error | pyramiding is negative |
| B007 | error | quantity is not positive |
| B008 | error | commission or slippage is negative |
| B009 | error | exit target given in ticks and as a price |
| B010 | error | trailOffset without trailPoints |
| B011 | error | leverage out of range |
| B012 | warning | processOrdersOnClose combined with the bar magnifier |
| B013 | error | strategy position read in setup |
| B014 | error | initial capital is not positive |
Internal (I…)
Failures of the compiler itself rather than of the script.
| Code | Severity | Summary |
|---|---|---|
| I000 | error | internal compiler error |