What levels is handed. It carries bars and valuesand spreads the
settings keys onto itself, so the built-ins written against the original
levels(settings) signature keep working unchanged: they read
ctx.overbought (or pass ctx to a num(s, key, default) helper) and find
exactly what they found before. A widened parameter is the only way a level
can be data-derived (yesterday's high, the session VWAP band), and that is a
whole class of level that could not be expressed at all before.
The three data members are optional for the same backward-compatibility
reason, not because the runtime ever omits them: it always passes all three,
but a caller holding only a settings bag must still be able to invoke
levels directly. A descriptor that needs the data should default them
(ctx.bars ?? []).
settings, bars and values are therefore reserved keys, the way
timezone already is in the settings a calc receives: an input declared
under one of those names is shadowed here.
What
levelsis handed. It carriesbarsandvaluesand spreads the settings keys onto itself, so the built-ins written against the originallevels(settings)signature keep working unchanged: they readctx.overbought(or passctxto anum(s, key, default)helper) and find exactly what they found before. A widened parameter is the only way a level can be data-derived (yesterday's high, the session VWAP band), and that is a whole class of level that could not be expressed at all before.The three data members are optional for the same backward-compatibility reason, not because the runtime ever omits them: it always passes all three, but a caller holding only a settings bag must still be able to invoke
levelsdirectly. A descriptor that needs the data should default them (ctx.bars ?? []).settings,barsandvaluesare therefore reserved keys, the waytimezonealready is in the settings acalcreceives: an input declared under one of those names is shadowed here.