Ora
All guides All guides

Getting started

Your first decision in the Playground Call the API from your code Save, share and reuse queries

Financial decisions

Decide on a stock with just its symbol Write your own rule Read probabilities and choose thresholds

Rule playground

From English to rule Combining conditions Offsets and windows Reading beliefs Rules plus forecasts in one request Turning a rule into an alert or workflow

Automation

Send a Slack alert when a rule fires Send decisions to your own system Run a watchlist every day after the close

Production

Handle errors, rate limits and retries

Cookbooks

All cookbooks Rank a watchlist by probability Send a pre-open digest Trend filter plus entry trigger Breakout confirmation with volume RSI and Bollinger mean-reversion checks Gap-fill playbook to your order system Confidence-gated actions Detect two-way risk Size positions by volatility regime Risk guardrail before an order Ask many questions in one request Self-consistency: three wordings Route support tickets Is a headline relevant to a symbol?

Use cases

Tag financial news for trading signalsGuardrails for LLM appsSupport ticket triage and routingFilter retrieved passages before your LLM answersVerify claims and citations against a source

Guides / Rule playground

Rule playground · about 8 min

Offsets and windows

Look back with offsets and ref(), choose between windows that include today and ones that do not, and know what happens when history runs out.

  1. The request

    Eleven rules on XLE:

    {
      "model": "ora-fin1",
      "state": {
        "symbol": "XLE"
      },
      "questions": {
        "today_up": {
          "type": "yes_no",
          "ask": "C > C[-1]"
        },
        "yesterday_up": {
          "type": "yes_no",
          "ask": "C[-1] > C[-2]"
        },
        "ref_form": {
          "type": "yes_no",
          "ask": "C > ref(C, -1)"
        },
        "week_ago": {
          "type": "yes_no",
          "ask": "C > C[-5]"
        },
        "future": {
          "type": "yes_no",
          "ask": "C > C[1]"
        },
        "breakout": {
          "type": "yes_no",
          "ask": "C > highest(C, 20)"
        },
        "never": {
          "type": "yes_no",
          "ask": "C > max(C, 20)"
        },
        "at_max": {
          "type": "yes_no",
          "ask": "C >= max(C, 20)"
        },
        "ma_rising": {
          "type": "yes_no",
          "ask": "sma(C, 20) > ref(sma(C, 20), -5)"
        },
        "year": {
          "type": "yes_no",
          "ask": "C > sma(C, 250)"
        },
        "too_long": {
          "type": "yes_no",
          "ask": "C > sma(C, 2000)"
        }
      }
    }
    Open this in the Playground
  2. The answers

    Session of 2026-10-30:

    QuestionRuleBelief
    today_upC > C[-1]0.9085
    yesterday_upC[-1] > C[-2]0.6708
    ref_formC > ref(C, -1)0.9085
    week_agoC > C[-5]0.7066
    futureC > C[1]0.5
    breakoutC > highest(C, 20)0.6462
    neverC > max(C, 20)0.5
    at_maxC >= max(C, 20)0.5
    ma_risingsma(C, 20) > ref(sma(C, 20), -5)0.9425
    yearC > sma(C, 250)0.9463
    too_longC > sma(C, 2000)0.5
  3. Offsets count back

    C[-1] is yesterday's close, C[-5] a week ago. C > ref(C, -1) is the same rule as C > C[-1] (both 0.9085). A positive offset looks at a bar that does not exist yet, so C > C[1] is 0.5.

  4. ref() for everything else

    Offsets work on price letters only. To look back at an indicator, use ref(): sma(C, 20) > ref(sma(C, 20), -5) asks whether the 20-day average is higher than a week ago (0.9425).

  5. Including or excluding today

    highest(C, 20) is the 20 sessions before today; max(C, 20) includes today. So C > highest(C, 20) (0.6462) is the breakout, and C > max(C, 20) (0.5) can never be more than a tie.

  6. When history runs out

    About 1,500 sessions are loaded. A window longer than that is not known, so C > sma(C, 2000) is 0.5, while C > sma(C, 250) is 0.9463.

Information, not investment advice. Every number on this page is a real response for the session shown; answers change with each session.

What's next

Create an account Open the Playground Everything here also lives in the console, next to your keys and usage.