EngineIndicators & Algorithms

Getting started

Observe a registered calculation from SJS before using it to request execution.

Start with the complete SMA observer. Paste that script into a fresh SJS experiment and run a short historical period with available one-minute data.

Use an experiment without other order-producing layers when you want to inspect calculations alone. The observer does not request orders, but it does not disable other configured actions.

Follow the calculator call

The script calls await cal("sma", { minutes: 3 }). The engine resolves the registered L2 model, creates a calculator instance, and passes it the current session context and bar.

The current SMA requests one-minute history from three minutes before bar.date through bar.date. It averages the rows actually returned. The number three describes a time window; it does not require exactly three input rows.

Inspect usable output

The observer logs sjs-sma only when the result is a finite number. Zero is valid. Missing history can produce no usable value, and the normal calculator helper returns null for missing calculators or caught calculation failures.

Check the logged frame time, result, and actual historical coverage. A finite average alone does not prove complete coverage or the intended number of observations.

Compare with a local calculation

The SJS crossover calculates the mean of its last three accepted closes. That fixed-count window belongs to script state and resets according to its gap rule.

The registered SMA uses a historical time window. Gaps, inclusive endpoints, and provider aggregation can make its result differ from the local mean even when both are called a three-period average.

Make one controlled change

Change the calculator's minutes value, keep the run's instrument and data selection fixed, and inspect the resulting outputs. Do not add order submission until the meaning and availability of those outputs are clear.

Next, read configuration to distinguish a calculator call from a persistent model instance.

On this page