Ora
All documentation Overview

Get started

IntroductionQuickstartHow ora-fin1 decidesHow to build with OraUse-case map

Rule language

OverviewGrammarOperators and beliefsPrices and offsetsWindowsIndicatorsSignals and eventsPattern functionsFunction referenceRule libraryCommon mistakesError messagesEarnings and dividend facts

Questions & answers

Questionsyes_no (noul)choicescoreConfidenceThresholds and calibrationStateAsk by symbol

Patterns

Patterns

Actions & workflows

OverviewRules and templatesDestinationsWebhooks and signaturesWorkflows

API reference

POST /v1/systemoneGET /v1/models

Errors & limits

ErrorsRate limitsKnown limitations

Pricing

Pricing

Resources

FAQChangelogModels & versionsCode in 8 languages

Docs / Rule language

Rule language

Windows

A window function looks at the last n bars of any series: a price, an expression such as H - L, or another function. The one rule to remember is which windows include the current bar.

Includes todayExcludes today
sma avg mean sum min max std zscore median wma ema rma linreg highestbars lowestbarshighest lowest; percentrank ranks today against the n − 1 bars before it
highest is the breakout form

C > highest(C, 20) compares today with the 20 sessions before it, so it can be true. C > max(C, 20) compares today with a window that contains today, so at best the two sides tie. On XLE (2026-10-30), which closed at a 20-session high: breakout 0.6462, > max 0.5, >= max 0.5.

Warm-up

A window needs n bars before it has a value. Until then the comparison answers 0.50, never true: C > sma(C, 2000) is 0.5 on XLE because 2,000 sessions are more than the history loaded, while C > sma(C, 250) is 0.9463. A recent listing has the same effect on long windows.

Anything can go in a window

(H - L) > 2 * avg(H - L, 20)          range against its own average
sum(C > C[-1], 10) >= 6                count up days
obv() > sma(obv(), 20)                 a function of a function
std(log(C / C[-1]), 20) * sqrt(252)    annualized volatility

Window functions

sma(x, n)

Simple moving average of the last n bars, including the current one.

ExampleC > sma(C, 50)Above the 50-day average.
Belief, 2026-10-30SPY 0.1128NVDA 0.0746TSLA 0.8961XLE 0.9432Try it
avg(x, n)

Another name for sma(). Same result.

ExampleV > avg(V, 20)Volume above its 20-day average.
Belief, 2026-10-30SPY 0.9463NVDA 0.9241TSLA 0.7475XLE 0.4991Try it
mean(x, n)

A third name for sma().

ExampleC > mean(C, 100)Above the 100-day average.
Belief, 2026-10-30SPY 0.3575NVDA 0.1141TSLA 0.9032XLE 0.9463Try it
sum(x, n)

Rolling sum of the last n bars. Summing a comparison counts the bars where it held.

Examplesum(C > C[-1], 10) >= 6Up on at least six of the last ten sessions.
Belief, 2026-10-30SPY 0.5NVDA 0.1194TSLA 0.1318XLE 0.8416Try it
min(x, n)

Lowest value of the last n bars, INCLUDING the current one.

ExampleC < 1.02 * min(L, 20)Closed within 2% of the 20-day low. (L <= min(L, 20) would be a poor rule: min includes today, so the two sides are at best equal, and a tie answers 0.50.)
Belief, 2026-10-30SPY 0.8006NVDA 0.5206TSLA 0.0537XLE 0.0545Try it
max(x, n)

Highest value of the last n bars, INCLUDING the current one. So C > max(C, n) can never be true.

ExampleC >= 0.98 * max(H, 20)Closed within 2% of the 20-day high.
Belief, 2026-10-30SPY 0.0814NVDA 0.0537TSLA 0.4008XLE 0.8483Try it
highest(x, n)

Highest value of the n bars BEFORE the current one. This is the breakout form.

ExampleC > highest(C, 20)Closed above every close of the previous 20 sessions.
Belief, 2026-10-30SPY 0.0537NVDA 0.0537TSLA 0.2882XLE 0.6462Try it
lowest(x, n)

Lowest value of the n bars before the current one.

ExampleC < lowest(C, 20)Closed below every close of the previous 20 sessions.
Belief, 2026-10-30SPY 0.6662NVDA 0.774TSLA 0.0537XLE 0.0537Try it
std(x, n)

Standard deviation over the window (population form, like most charting tools).

Examplestd(C, 10) < 0.5 * std(C, 50)Recent swings are less than half their longer-run size: compression.
Belief, 2026-10-30SPY 0.2067NVDA 0.3837TSLA 0.1204XLE 0.8148Try it
zscore(x, n)

How many standard deviations the current value sits from its window mean. A flat window scores 0.

Examplezscore(C, 20) < -2More than two deviations under the 20-day mean.
Belief, 2026-10-30SPY 0.6611NVDA 0.3733TSLA 0.0537XLE 0.0542Try it
median(x, n)

Middle value of the window. Less pulled by one wild day than an average.

ExampleV > 2 * median(V, 20)Volume more than twice its typical (median) day.
Belief, 2026-10-30SPY 0.7909NVDA 0.2837TSLA 0.0586XLE 0.0537Try it
percentrank(x, n)

Where the current value ranks among the n − 1 bars before it, 0 to 100.

Examplepercentrank(V, 50) > 90Volume in the top tenth of the last 50 sessions.
Belief, 2026-10-30SPY 0.6791NVDA 0.5398TSLA 0.219XLE 0.1283Try it
wma(x, n)

Linearly weighted moving average: recent bars count more.

Examplewma(C, 10) > wma(C, 30)Fast weighted average above the slow one.
Belief, 2026-10-30SPY 0.2218NVDA 0.0919TSLA 0.9256XLE 0.9219Try it
ema(x, n)

Exponential moving average, smoothing 2 / (n + 1).

ExampleC > ema(C, 21)Above the 21-day EMA.
Belief, 2026-10-30SPY 0.0803NVDA 0.0732TSLA 0.9209XLE 0.9281Try it
rma(x, n)

Wilder's smoothing, 1 / n: what RSI and ATR are built from.

ExampleC > rma(C, 14)Above a Wilder-smoothed 14-day average.
Belief, 2026-10-30SPY 0.0857NVDA 0.0725TSLA 0.9227XLE 0.9354Try it
linreg(x, n)

The least-squares line through the window, read at the current bar: a smoothed level, not the slope.

Examplelinreg(C, 20) > ref(linreg(C, 20), -5)The 20-day regression level is higher than a week ago: rising.
Belief, 2026-10-30SPY 0.1916NVDA 0.157TSLA 0.9118XLE 0.7215Try it
roc(x, n)

Percent change over n bars: roc(C, 20) = 5 means up 5% in 20 sessions.

Exampleroc(C, 20) > 5Up more than 5% over the last 20 sessions.
Belief, 2026-10-30SPY 0.0537NVDA 0.0537TSLA 0.681XLE 0.897Try it
cum(x)

Running total from the first bar loaded.

Examplecum(C > C[-1]) > cum(C < C[-1])More up days than down days across all the history loaded (about 1,500 sessions).
Belief, 2026-10-30SPY 0.9463NVDA 0.9463TSLA 0.9463XLE 0.9463Try it
highestbars(x, n)

How many bars ago the window's high was set, 0 to n − 1 (0 = this bar). The window includes the current bar.

Examplehighestbars(H, 20) <= 3The 20-day high was set in the last four sessions.
Belief, 2026-10-30SPY 0.0576NVDA 0.0566TSLA 0.6049XLE 0.7483Try it
lowestbars(x, n)

How many bars ago the window's low was set (0 = this bar).

Examplelowestbars(L, 20) >= 15The 20-day low is at least 15 sessions old.
Belief, 2026-10-30SPY 0.0614NVDA 0.06TSLA 0.1557XLE 0.7969Try it

Information, not investment advice. Beliefs and probabilities on this page are real responses for the session shown and change with every session.

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