Every entry below is a real engine message. The heading is the exact string you will see in the editor, followed by the cause and the fix. Use your browser find (Cmd/Ctrl+F) to jump straight to the error text you got.
If your script ran but drew nothing, the error is probably not a hard error at all. Skip to Runtime diagnostics for the "ran but blank" cases.
zero bars to compute; no source data reached the bar loop
Symptom: the run fails immediately with zero bars to compute; no source data reached the bar loop (add an ohlcv anchor and ensure data is delivered).
Cause: nothing fed the bar loop. An offchart script with no source has no timeline to iterate over, so the engine never enters the per-bar computation.
Fix: anchor the script to a series with ohlcv(symbol=currentSymbol, exchange=currentExchange) (or any source(...)). One anchor is enough.
Before, no anchor:
//@version=2
define(title="Zero Bars Without Anchor", position="offchart", axis=true)
plotLine(value=barIndex, colors=["#dc2626"], width=2, label=["Bar index"], desc=["offchart script without source anchor"])After, anchored:
//@version=2
define(title="Zero Bars Fixed With Anchor", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
plotLine(value=trade.close, colors=["#2563eb"], width=2, label=["Close"], desc=["ohlcv anchor reaches the bar loop"])Plot function 'line' is missing the 'label' parameter
Symptom: the build fails with Plot function 'line' is missing the 'label' parameter. Expected 1 label(s) for 1 data series.
Cause: every plotted series needs a non-empty label, and labels must be unique across the script. The label powers the editor legend and is the output's identity in the alert picker, so the strict build requires one per series and rejects blanks or duplicates. (desc is optional and is not validated.)
Fix: add a label per series and keep the names unique. The count must match the number of series you plot.
Missing label:
//@version=2
define(title="Missing Label Gotcha", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
plotLine(value=trade.close, colors=["#dc2626"], width=2, desc=["line plot without label"])Fixed:
//@version=2
define(title="Plot Label Desc Fixed", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
plotLine(value=trade.close, colors=["#2563eb"], width=2, label=["Close"], desc=["line plot with required metadata"])Script exceeds the source budget (N/20)
Symptom: the build fails with Script exceeds the source budget (21/20), and the run fails with Data source limit exceeded at <line>:<col>: count=21, limit=MAX_SOURCES_PER_SCRIPT, max=20.
Cause: a script can subscribe to at most 20 distinct sources, and you declared more. Heavy source types count for more than one: orderbook counts as 3, so a handful of order books reaches the cap fast. Identical source(...) calls dedupe to one, so this is about distinct subscriptions, not lines of code.
Fix: stay at 20 or fewer distinct sources, counting weighted types by their weight. Derived series (htf(), math on an existing source) are free; they fetch nothing. The editor and the runtime enforce the same 20, so anything that runs also passes validation.
Indexing is only allowed on timeseries and arrays
Symptom: compile and build fail with Indexing is only allowed on timeseries and arrays at <line>:<col>.
Cause: you used history indexing (x[1]) on a var. A var is a single per-bar scalar with no history, so there is nothing to index back into. Only timeseries and arrays carry indexable history.
Fix: hold any value you want to look back on in a timeseries, then index it.
Broken, indexing a var:
//@version=2
define(title="Var History Index Gotcha", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
var closeNow = trade.close
var previousClose = closeNow[1]
plotLine(value=previousClose, colors=["#dc2626"], width=2, label=["Previous"], desc=["var history indexing error"])Fixed, indexing a timeseries:
//@version=2
define(title="Timeseries History Index Fixed", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
timeseries closeSeries = trade.close
var previousClose = barIndex > 0 ? closeSeries[1] : closeSeries
plotLine(value=closeSeries - previousClose, colors=["#2563eb"], width=2, label=["Delta"], desc=["history indexing on timeseries"])Array indexing is always fine, including nested cells:
//@version=2
define(title="Array Celled Index Fixed", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
var vp = [[trade.low, trade.close, trade.high], [trade.open, trade.close, trade.volume]]
var i = 0
var score = vp[0][i + 1] + barIndex
plotLine(value=score, colors=["#16a34a"], width=2, label=["Array cell"], desc=["nested indexing on an array-shaped value"])Negative indexes: close[-1] is not array tail access
Symptom: a script that used close[-1] no longer reads the next bar.
Cause: since 3.0.13 (in-flight), negative timeseries subscripts return na. The old behavior was a lookahead bug: close[-1] read a future bar. Arrays still intentionally support negative tail indexing, so arr[-1] reads the last array element.
Fix: for timeseries, use only non-negative history offsets: close[0] for the current bar, close[1] for one bar ago. For arrays, keep using negative indexes when you want tail access.
The probe reported ok: true; both the series-negative check and array-tail check produced 300 finite values from bar 0 to 299 (104.43197504692071 to 115.98246199046476).
//@version=2
define(title="Negative Index Series Array", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
timeseries closeSeries = trade.close
var values = [trade.open, trade.high, trade.low, trade.close]
var seriesCheck = isna(closeSeries[-1]) ? closeSeries : na
var arrayCheck = values[-1] == trade.close ? trade.close : na
plotLine(value=seriesCheck, colors=["#2563eb"], width=2, label=["Series negative"], desc=["negative timeseries history indexes return na"])
plotLine(value=arrayCheck, colors=["#16a34a"], width=2, label=["Array negative"], desc=["negative array indexes wrap from the tail"])Undefined identifier '<name>'
Symptom: the build rejects the source call with source() arg references script var(s) <name>; use a literal, an env identifier (currentSymbol/currentCoin), an input, or an inline env expression, and the run fails with Undefined identifier '<name>'.
Cause: you passed a script variable as a source() argument. Source arguments are resolved before your script's variables exist, so they cannot reference a var.
Fix: pass a literal, an environment identifier (currentSymbol, currentExchange, currentCoin), an input(...), or an inline environment expression directly in the call.
Broken, var in a source argument:
//@version=2
define(title="Source Arg Script Var Gotcha", position="offchart", axis=true)
var wantedSymbol = currentSymbol
timeseries trade = ohlcv(symbol=wantedSymbol, exchange=currentExchange)
plotLine(value=trade.close, colors=["#dc2626"], width=2, label=["Close"], desc=["script variable used in source argument"])Fixed, environment identifiers inline:
//@version=2
define(title="Source Arg Literal Fixed", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
plotLine(value=trade.close, colors=["#2563eb"], width=2, label=["Close"], desc=["source argument uses currentSymbol and currentExchange"])first line must be //@version=2
Symptom: the build fails with first line must be //@version=2 (no marker = deprecated v1; @version=3 silently downgrades).
Cause: the version header is missing or not on the first line. No marker is treated as deprecated v1, and @version=3 silently downgrades, so neither does what you want.
Fix: make //@version=2 the literal first line of the script, before define(...).
//@version=2
define(title="Version Header Fixed", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
plotLine(value=trade.close, colors=["#2563eb"], width=2, label=["Close"], desc=["script with version header"])Unknown math method: avg
Symptom: the run fails with Unknown math method: avg.
Cause: there is no math.avg. It is easy to assume it exists, but it is not part of the math namespace.
Fix: average the values yourself with (a + b) / 2.
Broken:
//@version=2
define(title="Math Avg Gotcha", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
var average = math.avg(trade.open, trade.close)
plotLine(value=average, colors=["#dc2626"], width=2, label=["Average"], desc=["unknown math.avg method"])Fixed:
//@version=2
define(title="Math Average Fixed", position="offchart", axis=true)
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange)
var average = (trade.open + trade.close) / 2
plotLine(value=average, colors=["#2563eb"], width=2, label=["Average"], desc=["manual average without math.avg"])Got 'bool' (use boolean)
Symptom: an input(...) type fails with Got 'bool'.
Cause: the input type is spelled boolean. There is no bool alias.
Fix: use "boolean" as the input type name.
Blank plot from a source member typo
Symptom: the script compiles and runs, but the plot is empty. The diagnostics show COMPUTE_ALL_NAN and RENDER_NO_DRAWABLE.
Cause: you read a source member that does not exist (for example funding.close when the field is funding.value). Member names are not checked at compile time, so a typo silently yields na on every bar and the plot has nothing to draw.
Fix: check the member list for that source type in Data Sources. For funding_rate, the member is value, not close.
Blank or flat anchored VWAP
Symptom: an anchored VWAP plots nothing, or a perfectly flat line. The diagnostics show COMPUTE_ALL_NAN or a flat-line warning.
Cause: the loaded window never crosses the anchor boundary. A monthly anchor needs a window long enough to contain a month start; if every loaded bar falls inside the same period, the anchor never resets and the series stays na. This is about loaded history, not about whether you stored the result in var.
Fix: load more bars, or choose a shorter anchor (day, week) that the window actually crosses. See Special Indicators for the history each anchor needs.
Runtime diagnostics
Some scripts compile and run, then draw nothing useful. The engine catches these and emits a runtime diagnostic instead of leaving you with a blank panel. Each one has a code, a stage (compute or render), and a severity. A clean run reports none of them.
error-severity diagnostics mean nothing drew. warning-severity diagnostics let the run through but flag a likely problem.
| Code | Stage / severity | Message | Cause and fix |
|---|---|---|---|
COMPUTE_ZERO_BARS | compute / error | runtime had zero bars to compute; no source data reached the bar loop | No source delivered data to the bar loop. Add an ohlcv anchor and make sure the run has data. See the section above. |
RENDER_NO_PLOT | render / error | runtime produced no plot outputs, so there is nothing to draw | The script computed but called no plot*. Add at least one plot or drawing. |
COMPUTE_ALL_NAN | compute / error | plot "<id>" is NaN for every computed bar | A plotted series is na on every bar: an indicator that never warmed up, a wrong source member, or an anchor that never crossed. Check warmup length, member names, and anchor windows. |
RENDER_NO_DRAWABLE | render / error | plot "<id>" has no finite values to draw | The render-side companion to COMPUTE_ALL_NAN: the plot has no finite value anywhere. |
COMPUTE_TRAILING_NAN | compute / warning | plot "<id>" becomes NaN after bar <n> | The series was finite, then went na partway through (often a divide-by-zero or a lookback that outran the data). The line stops drawing at that bar. |
RENDER_SPARSE_OUTPUT | render / warning | plot "<id>" has only <n> drawable value(s) across <m> bars | Very few finite points relative to the bar count, usually a condition that rarely fires or a marker on isolated bars. Often intentional; flagged so a near-blank plot is not mistaken for a bug. |