Dependency outputs
A correct indicators.declare does not put a number on every bar. The dependency's warmup, bars it chose not to emit, and gaps in the data all read as undefined. Guard every read, and treat an empty value as "skip this bar", not as zero.
Pattern
Declare the dependency with
indicators.declare, and in a study the definitions it measures withflows.declare. See Declaring indicator dependencies.Read through
ctx.indicators.<as>.<outputKey>,ctx.flows.<as>or the event payload.Check for
null/undefinedbefore you plot, emit or collect.
function onBar(ctx) {
const v = ctx.indicators.atr14.atr.value;
if (v == null) return; // declared, no value on this bar
ctx.plot("atr", v);
}Never plot undefined or NaN: skip the call instead.
Declared vs had data
What you see | Meaning | Fix |
|---|---|---|
Lint error on the declare or the read | The slug, version or output key is wrong | Fix the declaration or the key. The lint message lists the keys that exist |
| Warmup, a sparse output or a data gap | Guard and skip |
| Your script read this output, and it had no finite value anywhere in the calculated window | Check the dependency's settings, its |
dependency_output_unavailable fires only for an output your script actually read, so an unused output never warns. It names the alias, the slug, the version and the output key. Dependency unavailable walks through the common causes.
Sparse outputs
Some outputs emit only on certain bars, such as a swing-high marker. On the other bars value is undefined. Use last() for the most recent emitted value and lastTime() for when it happened. at(1) is the previous emit, not the previous bar.
Ranges and levels
Zones, levels and trendlines are not series. Read them through lifecycle() on the alias, which says whether each one is live or closed and why. The raw ranges() / hlines() rows are paint data: a non-replace hline can have several segments at once, and the rows do not tell you which closed.
