EngineSQL-Inspired Rules / SQX

Conditions

Compare scalar and model values without assuming unsupported boolean grouping.

A conditional rule calculates the left-hand model and compares its value with a scalar or another registered model. Use the model's documented return type and parameters.

Scalar and model comparisons

TICK price > 50 THEN FINAL skipall
TICK sma WITH minutes=3 > sma WITH minutes=10 THEN FINAL skipall

These are separate illustrative skip rules, not an entry strategy. A model-to-model comparison calculates both sides; it does not read two arbitrary JavaScript variables.

Use the supported operators >, <, >=, <=, =, ==, ===, and !=. Equality operators in the runtime compare strictly; != uses JavaScript's loose inequality. Keep both sides the same intended type rather than relying on coercion.

AND and repeated models

TICK price > 50 AND price < 60 THEN FINAL skipall

Both checks must match. Repeating a model preserves separate calculations and parameters. Comparisons are evaluated together rather than short-circuiting, so an early false comparison is not a guard that prevents another calculation from running.

OR and parentheses are not supported reliably in text

The current text parser splits both AND and OR tokens into calculations, then assigns AND to a multi-condition group. As a result, writing OR can parse successfully while behaving as AND. Parenthesized and nested groups are not accepted.

The underlying structured multi-rule runtime has an OR mode, but that does not establish OR support in the SQX text path. Do not copy structured examples into text and assume equivalent behavior. Use explicit SJS branching when you need OR, precedence, or nested logic.

Separate rules can sometimes express independent alternatives, but both may run and update the same target. They are not a universal replacement for a grouped expression.

Missing values and repeated matches

The comparison layer has no universal finite-number or readiness check. Models can return undefined, null, neutral values, or structured output; relational comparisons can coerce some values unexpectedly. Validate readiness in SJS when your decision depends on that guarantee.

A condition is checked again on subsequent eligible frames. Being above a threshold is not a crossing event and does not mean “act once.” Track transitions and consumed events explicitly in SJS when needed.

Continue with indicators.

On this page