Documentation Index
Fetch the complete documentation index at: https://docs.darvas.app/llms.txt
Use this file to discover all available pages before exploring further.
Line limit exceeded
Line limit exceeded
Message:
Line limit exceeded (500). Oldest lines have been truncated.Cause: Your script created more than 500 Line entities. With dynamic keys like Line(\ph_$`, …)` on every bar, this fills up quickly on large bar counts.Fix: Only create lines on confirmed events (pivot detections, signals), not every bar. Or use a fixed pool of keys with extend: "right" and update them in place with .set():Series limit exceeded
Series limit exceeded
Message:
Series limit exceeded (64).Cause: Your script created more than 64 Series instances (including internal ones created by ta.barssince and ta.cum).Fix: Count your Series. Reuse them where possible. Remember that each unique ta.barssince(key, ...) call takes one slot. Combine multiple related state variables into a single Series by encoding them (e.g. use one Series for price + another for index, not three for different values from the same event).LineFill source lines must share forceOverlay
LineFill source lines must share forceOverlay
X is not a function
X is not a function
Message:
TypeError: X is not a function where X is a ctx.* accessor or ta.* call.Common causes:- Calling
ctx.closewithout parentheses when you want the value: usectx.close()for the scalar,ctx.closefor the source reference. - Passing a scalar where a source function is required:
ta.ema(ctx.close(), 20)passes a number, not a source.
Silent NaN propagation - plot shows no line
Silent NaN propagation - plot shows no line
Symptom: A plot series appears blank or shows only a partial line with no visible values.Cause: The value emitted to
plot() is NaN (often from an indicator in its warmup period, or from arithmetic on a null close value).Debug steps:- Add
console.log("value:", value)insideonBarand check the Console panel. - Look for
NaNornullin the output. - Wrap with
nz()or add an earlyif (na(value)) returnguard.
Stale handle warning - entity not updating
Stale handle warning - entity not updating
Symptom: A
Line or Box stops updating partway through the chart.Cause: You recreated the entity with the same key (new gen), but kept using the old handle returned from the first call. The old handle’s .set() calls silently no-op.Fix: Always capture the return value from the latest factory call:TIMEOUT - top-level eval exceeded 1.5s
TIMEOUT - top-level eval exceeded 1.5s
Message:
TIMEOUT: top-level evaluation exceeded 1.5sCause: Top-level code (outside onBar) ran for too long. This usually means a large loop or expensive synchronous work at the script root.Fix: Move computation inside onBar. Only declarations (input.*, plot(), Series()) belong at the top level. If you genuinely need top-level computation, simplify it.TIMEOUT - per-bar onBar exceeded 50ms
TIMEOUT - per-bar onBar exceeded 50ms
Message:
TIMEOUT: onBar execution exceeded 50ms at bar NCause: One onBar call took more than 50ms. Usually caused by a nested loop over the entire bar history inside onBar.Fix: Replace manual loops with ta.* functions (Rust-native, much faster). See Performance tips.General debugging workflow
Check the Console panel
Open the Console tab in the editor. All
console.log, console.warn, errors, and budget warnings appear here.Add log statements
Add
console.log("key:", value) at the top of onBar to see what values are flowing through. Remember: only the last 100 lines x 200 chars are shown.Check for NaN with na()
If a plot is blank, add
if (na(myValue)) console.log("NaN at bar", ctx.i()) to find the first bar where the value goes missing.Related pages
Gotchas
Conceptual traps that cause these errors.
API limits
All budget numbers.
Performance tips
How to avoid timeout errors.