Guides / Cookbooks
Cookbooks · Signals: rules plus forecasts · Intermediate · about 8 min
Trend filter plus entry trigger
Only take long entries while price is above its 200-day average, and only when the forecast for the week leans up and the drawdown odds are not high.
When to use it
A trend filter is a fact about today ("is the close above the 200-day?"), and the rule engine answers it from the price history. The trigger is a forecast ("higher in a week?"), answered by the financial model. One request carries both, and one action fires only when they agree.
The request
trendsends the rule directly withask.trend_enasks the same thing in English to show that it compiles to the same rule.{ "model": "ora-fin1", "state": { "symbol": "QQQ" }, "questions": { "trend": { "type": "yes_no", "ask": "C > sma(C,200)" }, "trend_en": { "type": "yes_no", "instructions": "Is it above its 200-day moving average?" }, "up_week": { "type": "yes_no", "instructions": "Will the stock be higher in a week?" }, "drop5": { "type": "yes_no", "instructions": "Will it drop at least 5% at some point in the next month?" } }, "actions": [ { "id": "entry", "when": "trend >= 0.6 and up_week >= 0.55 and drop5 < 0.5", "do": "webhook", "connection": "my-oms", "body": { "symbol": "{{symbol}}", "signal": "trend_entry", "p_trend": "{{trend}}", "p_up_week": "{{up_week}}", "p_drop5": "{{drop5}}", "as_of": "{{as_of}}" } } ], "dry_run": true }Open this in the PlaygroundThe real response
QQQ:
{ "model": "ora-fin1", "answers": { "trend": { "type": "yes_no", "yes_no": 0.7987, "rule": "C > sma(C,200)", "basis": "rule" }, "trend_en": { "type": "yes_no", "yes_no": 0.7987, "rule": "C > sma(C, 200)", "basis": "comparison", "explain": "today's close > sma200" }, "up_week": { "type": "yes_no", "yes_no": 0.561 }, "drop5": { "type": "yes_no", "yes_no": 0.443 } }, "usage": { "input_tokens": 387, "output_tokens": 16 }, "context": { "source": "server", "symbol": "QQQ", "as_of": "2026-10-30" }, "version": "ora-fin-0.1.1", "actions": [ { "id": "entry", "fired": true, "status": "dry_run", "do": "webhook", "connection": "my-oms", "preview": { "body": { "symbol": "QQQ", "signal": "trend_entry", "p_trend": 0.7987, "p_up_week": 0.561, "p_drop5": 0.443, "as_of": "2026-10-30" } } } ] }Both trend questions carry
"rule": "C > sma(C,200)"and the same belief, 0.7987; the English one adds"explain". Withup_weekat 0.561 anddrop5at 0.443, theentryaction fired and shows the exact webhook body it would send.The same request for IWM:
trend0.5564,up_week0.526,drop50.234. The action was skipped: a trend belief that close to 0.5 means the close is only just above its 200-day line, so it does not cleartrend >= 0.6.The code
Requires curl 7.76+. Save as run.sh, then: bash run.shcurl -sS https://oramodel.com/v1/systemone \ -H "Authorization: Bearer $JEV_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "ora-fin1", "state": { "symbol": "QQQ" }, "questions": { "trend": { "type": "yes_no", "ask": "C > sma(C,200)" }, "trend_en": { "type": "yes_no", "instructions": "Is it above its 200-day moving average?" }, "up_week": { "type": "yes_no", "instructions": "Will the stock be higher in a week?" }, "drop5": { "type": "yes_no", "instructions": "Will it drop at least 5% at some point in the next month?" } }, "actions": [ { "id": "entry", "when": "trend >= 0.6 and up_week >= 0.55 and drop5 < 0.5", "do": "webhook", "connection": "my-oms", "body": { "symbol": "{{symbol}}", "signal": "trend_entry", "p_trend": "{{trend}}", "p_up_week": "{{up_week}}", "p_drop5": "{{drop5}}", "as_of": "{{as_of}}" } } ], "dry_run": true }'Act on it
The action delivers a signed JSON body to your order system; the receiving side is in Send decisions to your own system. If you prefer to decide in your code, drop
actionsand compare the same numbers:a = {k: v["yes_no"] for k, v in data["answers"].items()} if a["trend"] >= 0.6 and a["up_week"] >= 0.55 and a["drop5"] < 0.5: submit_entry(symbol)Variations
- A faster filter:
C > sma(C,50), or a crossover:sma(C,20) > sma(C,50). - An exit rule in the same request:
{"type": "yes_no", "ask": "C < sma(C,200)"}. - Many more ready-made entry and exit pairs are under Examples → Strategies; the grammar is in Rule language.
- A faster filter:
Information, not investment advice. Every number on this page is a real response for the session shown; answers change with each session.