Debugging algorithms
Trace missing calculations, model selection problems, and conflicting execution layers.
Record the frame time, model name, instance ID, parameters, and selected runtime. Begin with an observation-only script so execution does not obscure a calculation problem.
A calculator returns no usable value
Verify the exact registered name and whether the model implements calculate. The normal helper returns null for missing calculators and caught errors. A valid calculator can also return no output when its history is empty.
Inspect the historical request and returned rows. Parameter mistakes, unsupported interval behavior, missing fields, and wrong instrument selection can all appear as a missing or invalid numeric result.
An instance cannot be found
Check the saved model configuration and instance ID. context.algos exposes configured L2 tick instances, not every model or calculator in the registry. Reading it does not create a new instance.
If the model belongs to another lifecycle collection, use its supported access contract. Do not silently instantiate a similarly named replacement and assume it shares the original state.
The value differs from another indicator
Compare the actual formulas and inputs: time window versus fixed row count, included endpoint, historical source, aggregation, gap behavior, and initialization. Matching names or the same numeric parameter do not establish matching horizons.
Preserve numeric zero while rejecting missing or non-finite output. Inspect any fallback that turns absence into a neutral-looking signal.
The value seems one update behind
Check the shared frame order. SJS runs before applicable configured L2/L1 callbacks and native Pine. A read during SJS can therefore see previously produced state. Verify the producer's timestamp convention and update interval before labeling it a data-provider delay.
An action did not happen, or happened twice
Identify every action owner: SJS, configured primitives, L3, and Pine. Inspect skip behavior, primitive transmission settings, execution gates, pending orders, and the branch selected for that frame.
A configured stop-loss callback is not automatically a resting broker stop. Trace its close request through execution debugging.
Preserve a small reproduction
Keep one model configuration, a short deterministic observation sequence where possible, the expected output, and the actual result. Add companion models only when they are documented dependencies. Link your report to the relevant run and source revision.
Return to the indicator catalog or primitive catalog for exact parameter names, and use SJS debugging for the surrounding strategy.