EngineSQL-Inspired Rules / SQX

Examples

Use small complete SQX configurations with explicit assumptions and outcomes.

Run each block separately in a fresh historical experiment. Keep other execution sources disabled while checking it. Both examples configure an order primitive with transmit=false; they update a note and do not submit orders on their own.

Inspect a time window

IF order type="market" action="buy" size=1 transmit=false note="outside window"
TICK time WITH tz="America/New_York" >= "09:30:00" AND time WITH tz="America/New_York" < "10:00:00" THEN order SET note="inside window", transmit=false

Expected behavior: the note changes inside the half-open local-time window and remains at its baseline outside it. The time model formats bar timestamps in the specified timezone.

This is a clock comparison, not an exchange calendar. It does not independently exclude weekends, holidays, or unexpected sessions. Do not treat it as a complete market-hours or freshness check.

Compare two averages

IF order type="market" action="buy" size=1 transmit=false note="comparison inactive"
TICK sma WITH minutes=3 > sma WITH minutes=10 THEN order SET note="fast above slow", transmit=false

Expected behavior: with usable historical values, the rule updates the note when the shorter-window result exceeds the longer-window result. Equal values do not match. This is a persistent relationship, not a one-time crossing event.

The calculations depend on the returned history and do not guarantee complete windows. Use SJS when missing-data validation must be part of the decision.

Verify before extending

The documentation tests parse every SQX block in these guides and check the complete examples' compiled configuration. That validates the source shape; run your selected historical fixture to validate calculations and branch behavior.

Inspect matching diagnostics and “not transmitting” logs. Check the saved declaration, target names, and transmission baseline before adding any execution action.

Continue with debugging.

On this page