Skip to main content

Rules: when your agent trades

Rules are true/false tests that control when your agent trades. They read indicator values and decide: should we trade this coin? Which direction? When should we exit?

Quick start: a squeeze breakout strategy​

Here's a complete rule set for trading Bollinger Band squeezes. This example shows how rules work together.

Rule nameTypeMust pass?What it checks
LIQUID_FLOORFilterYes24h volume is at least $1M — only trade liquid coins
SQUEEZE_ONFilterNoBollinger width below 8% AND ADX below 20 — the squeeze is forming
BREAK_UPSignals LongNoSQUEEZE_ON is true AND (close change > 1.5% OR RVOL > 2 OR %B > 1)
BREAK_DOWNSignals ShortNoSQUEEZE_ON is true AND (close change < -1.5% OR RVOL > 2 OR %B < 0)

How it works:

  1. LIQUID_FLOOR must pass — if volume is too low, the coin is skipped entirely
  2. SQUEEZE_ON detects compression — used by the directional rules
  3. When BREAK_UP reads true, the agent considers going long
  4. When BREAK_DOWN reads true, the agent considers going short

This is the pattern: filters gate, directional rules decide.


How rules work​

The three types​

Rule typeWhat it doesExample
FilterGates other rules — doesn't pick a direction"Only trade if volume is high enough"
Signals Long / Short / No tradePicks the trade direction when true"Go long when RSI leaves oversold"
Exit ruleCloses an open trade when true"Exit when price falls below the 20 SMA"

Must pass vs Info only​

SettingWhat happens when the rule reads false or has no data
Must passTrade evaluation stops — the coin is skipped
Info onlyYour agent still sees the rule's result, but it doesn't block the trade

Tip: Use "Must pass" for hard filters (liquidity, volatility). Use "Info only" for context you want your agent to consider but not require.


Building a rule​

Every rule has a definition made of clauses and groups.

Clauses​

A clause compares an indicator value against a threshold:

Clause exampleWhat it means
RSI14 is below 30RSI is in oversold territory
ATR_PCT is at least 0.5The coin moves at least 0.5% per candle on average
BB_WIDTH_PCT is at most 8Bollinger Bands are squeezed tight
dist_SMA20 crosses above 0Price just crossed above the 20 SMA

Operators​

OperatorWhen it's true
Above / BelowValue is strictly above or below the threshold
At least / At mostValue is at or above / at or below the threshold
Is betweenValue falls within a range
Crosses above / Crosses belowValue moved past the threshold since the last bar
Went up / Went downValue increased or decreased since the last bar

Groups​

Combine clauses with logic:

Group typeTrue when
All ofEvery clause in the group is true
Any ofAt least one clause is true
NotThe clause is false
At least N ofN or more clauses are true
In orderEach step is true on a later bar than the step before, all within the window, and the last step in the bar being decided

Example: A squeeze breakout needs All of:

  • SQUEEZE_ON is true (the filter you defined)
  • Any of: close change > 1.5%, RVOL > 2, %B > 1 (any release signal)

In order: one thing, then another​

In order turns a rule's top-level group into numbered steps (①, ②, …) with a window — "within 8 bars". The rule is true when step ① was true on some bar, step ② on a later bar, and so on, with the last step true in the bar being decided. Two steps never count the same bar.

Example: LONG_TRIGGER = In order within 8: ① NEAR_SWING_LOW, ② LTF_TURN_UP — price came near a swing low, and then the lower timeframe turned up, all inside 8 bars.

  • A step is one clause, one group of clauses, or another rule that reads a single bar. Every step is checked Once on each bar of the window — the window is the count.
  • Reorder steps with the arrows beside each step number. In order needs at least two steps.
  • The window can't be longer than every step's column keeps history for; the builder stops it there and says which step limits it.
  • In order is for entry rules only, and only as a rule's top-level group.
  • The rule's result reads like In order within 8 · 15M: ① 3 closes back → ② LTF_TURN_UP latest close — the bar each step was matched on.

Hold: checking multiple bars​

By default, each clause checks only the current bar. With Hold, you can require a condition across multiple bars.

Hold settingWhat it checks
OnceJust this bar (default)
N candles in a rowMust be true on N consecutive closed bars
Within last N candlesWas true at least once in the last N bars
At least N of last M candlesTrue on N or more of the last M bars

Example: "RSI below 30, within last 5 candles" catches a recent dip even if RSI has started recovering.

Important: Crossover operators (crosses above/below, went up/down) can only use "within" holds — they fire on specific bars, so "in a row" doesn't make sense.


Exit rules​

Exit rules close open trades. They're separate from entry rules and can't block entries.

ClosesWhat happens
LongsCloses your long position when true; blocks new longs while true
ShortsCloses your short position when true; blocks new shorts while true
BothCloses any position; blocks all new entries while true

Example exit rule: "Exit longs when RSI enters overbought" — protects profits by closing when momentum is exhausted.

Key difference from entry rules:

  • Entry rules can be "Must pass" — exit rules cannot
  • Entry rules pick a direction — exit rules just close
  • Open trades keep the exit rules they opened with, even if you edit them later

Why isn't my strategy trading?​

If your strategy isn't taking trades, check these common causes:

Checklist​

CheckHow to fix
No entry ruleYou need at least one rule that Signals Long/Short/No trade, OR one Must-pass rule. Filters alone won't trade.
Must-pass rule always failsCheck that your Must-pass rules can actually pass. Test with specific coins in the preview.
No data (Unresolved)If an indicator can't be read, Must-pass rules block. Check that your timeframes and indicators are available.
Conflicting rulesIf an exit rule reads true, new entries on that side are blocked.
Rule uses live candleRules reading "Includes the live candle" can't be used for direction decisions. Switch to "Closed candles only".

Outcomes explained​

OutcomeMeaning
TRUEThe rule passed — all clauses evaluated and met the criteria
FALSEThe rule failed — clauses evaluated but didn't meet criteria
No dataAn indicator couldn't be read — the rule couldn't evaluate at all

No data is different from FALSE. A Must-pass rule blocks the trade when it gets either FALSE or No data. A rule that simply isn't true returns FALSE. A rule that can't run (missing data, unavailable timeframe) returns No data.


Good to know​

  • Rule order matters — when multiple directional rules are true, the first one in your list wins
  • Rules can reference other rules — BREAK_UP can include "SQUEEZE_ON is true"
  • The builder prevents invalid combinations — it won't let you use a live-candle indicator in a direction-deciding rule

Advanced: Rule limits and validation

Platform limits​

The builder caps how many rules one strategy holds and how many clauses one rule holds. It shows each current cap — the rail counts rules used against the cap, and each rule counts its clauses — the platform can retune them, and a save past one is refused. A third cap bounds the frame reads: the total of the closes every clause counts across the strategy, plus one for each clause that compares against the bar before. A save past it is refused.

Save validation​

When you save, the builder checks:

  • Every indicator a rule references exists in your panels
  • No circular references (Rule A references Rule B which references Rule A)
  • Direction-deciding rules don't read live-candle indicators
  • Exit rules only read indicators that can update on completed bars

If validation fails, you'll see which rule and clause needs fixing.

Advanced: Forward references and cycles

Forward references​

You can reference a rule that appears later in your list. The builder resolves evaluation order automatically.

Cycles are blocked​

The builder rejects:

  • Self-reference: Rule A includes "Rule A is true"
  • Mutual reference: Rule A includes Rule B; Rule B includes Rule A
  • Transitive cycles: Rule A → Rule B → Rule C → Rule A
Advanced: Chart lines from rules

Level projection​

When a rule clause reads a price-based indicator (moving average, Bollinger Band, VWAP, etc.), the trading terminal can draw that level on the chart.

What gets drawn​

  • Two clauses on the same indicator → one line
  • Same indicator at different timeframes → separate lines
  • Closed vs live candle reads → separate lines (values can differ)

What doesn't get drawn​

Levels without clear price lineage are skipped:

  • Non-numeric indicators (labels, events)
  • Cross-sectional readings (rank)
  • Indicators without bar-by-bar history

Series curves​

Beyond horizontal levels, the chart can show the indicator's value over time as a curve. This helps you see what the rule has been reading historically.

Advanced: How your agent sees rules

In the Agent briefing​

Your agent sees each rule's current reading:

  • The rule name and what it checks
  • Whether it's currently TRUE, FALSE, or No data
  • For directional rules, which direction it signals

The condition checklist​

When your agent proposes a trade, it cites 1–8 rules in its reasoning:

  • CONFIRM — the rule read TRUE
  • WARN — the rule read FALSE but is Info only
  • REJECT — the rule read FALSE and is Must pass (trade would be blocked)

This helps you understand why the agent made its decision.


← Indicators · Indicator examples · Next: Agent instructions