> ## Documentation Index
> Fetch the complete documentation index at: https://uncoded.ch/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditions — The 41 Predicate Types

> The 41 condition types across 9 categories that turn indicator outputs into firing decisions. Comparison, range, trend, pattern, logic, time, volume, volatility, statistical.

<Info>
  **Conditions are the predicates that turn indicator outputs into 'fire / don't fire' decisions.** The SignalEditor exposes 41 condition types across 9 categories — wide enough that almost any tradable thesis can be expressed without composing custom logic.
</Info>

## Categories at a glance

| Category        | Examples                                          | Use for                                   |
| --------------- | ------------------------------------------------- | ----------------------------------------- |
| **Comparison**  | greater-than, crossover, crossunder               | Foundational threshold and crossing logic |
| **Range**       | within-range, outside-range, between              | Bracket-based decisions                   |
| **Trend**       | rising, falling, flat over N bars                 | Direction confirmation over a window      |
| **Pattern**     | higher-highs, breakout, double-bottom             | Pre-built chart patterns                  |
| **Logic**       | AND, OR, NOT, XOR                                 | Composing multiple conditions             |
| **Time**        | within-window, after-time, before-time            | Trading hour gating                       |
| **Volume**      | above-average, surge, dry-up                      | Volume confirmation                       |
| **Volatility**  | within-band, outside-band, contracting, expanding | Vol-regime detection                      |
| **Statistical** | z-score-above, percentile-threshold               | Rigorous mean-reversion                   |

## Comparison — the foundation

<AccordionGroup>
  <Accordion title="Greater-than / Less-than" icon="greater-than">
    `A > B`, `A < B`. Threshold logic. RSI > 70, price > EMA(50), volume > average × 2, etc.
  </Accordion>

  <Accordion title="Greater-than-or-equal / Less-than-or-equal" icon="greater-than-equal">
    Same as above with edge cases included.
  </Accordion>

  <Accordion title="Equal-to" icon="equals">
    Exact equality. Rare for continuous values; useful for indicator outputs that produce discrete states.
  </Accordion>

  <Accordion title="Crossover" icon="arrow-trend-up">
    `A` crosses **above** `B` on the current bar. Detects the moment of crossing.

    Best for: EMA cross signals (EMA20 crosses above EMA50), MACD signal-line crosses, RSI crossing back above 30 from oversold.
  </Accordion>

  <Accordion title="Crossunder" icon="arrow-trend-down">
    `A` crosses **below** `B` on the current bar.

    Best for: exit signals after a crossover-driven entry.
  </Accordion>
</AccordionGroup>

## Range — bracket decisions

<AccordionGroup>
  <Accordion title="Within-range" icon="ruler">
    Value is between low and high bounds (inclusive). Useful for "RSI is between 30 and 70" (neutral zone).
  </Accordion>

  <Accordion title="Outside-range" icon="ruler">
    Value is below low OR above high. The complement of within-range.
  </Accordion>

  <Accordion title="Between" icon="ruler">
    Value is between two indicator values (not fixed numbers). Useful for "price is between EMA(20) and EMA(50)" (in transition zone).
  </Accordion>
</AccordionGroup>

## Trend — direction confirmation

<AccordionGroup>
  <Accordion title="Rising over N bars" icon="arrow-up">
    Indicator value is consistently increasing over the last N bars. Use for "EMA is rising" (uptrend confirmation).
  </Accordion>

  <Accordion title="Falling over N bars" icon="arrow-down">
    Value consistently decreasing.
  </Accordion>

  <Accordion title="Flat over N bars" icon="arrows-left-right">
    Value within a tight range over N bars. Useful for "low volatility" detection alongside Bollinger Width.
  </Accordion>
</AccordionGroup>

## Pattern — pre-built chart patterns

<AccordionGroup>
  <Accordion title="Higher-highs" icon="arrow-up-right-dots">
    The recent N highs are progressively higher. Uptrend confirmation.
  </Accordion>

  <Accordion title="Lower-lows" icon="arrow-down-right">
    The recent N lows are progressively lower. Downtrend confirmation.
  </Accordion>

  <Accordion title="Double-bottom" icon="arrow-up-right">
    Two recent lows at similar price levels with a peak between. Reversal pattern.
  </Accordion>

  <Accordion title="Breakout-above-resistance" icon="arrow-trend-up">
    Price closes above a recent N-bar high. Classic breakout signal.

    Pair with volume surge for confirmation (see Volume conditions).
  </Accordion>

  <Accordion title="Breakdown-below-support" icon="arrow-trend-down">
    Price closes below a recent N-bar low. Breakdown signal.
  </Accordion>
</AccordionGroup>

## Logic — composing conditions

<AccordionGroup>
  <Accordion title="AND" icon="ampersand">
    Both sub-conditions hold simultaneously. The most-used composer.

    Example: `RSI < 30 AND price < EMA(50)` — RSI oversold and price below trend.
  </Accordion>

  <Accordion title="OR" icon="vertical-line">
    Either sub-condition holds.

    Example for an exit: "RSI > 70 OR price > EMA(50)" — exit if either condition triggers.
  </Accordion>

  <Accordion title="NOT" icon="ban">
    Inverts a sub-condition. Useful for "not in range" logic.
  </Accordion>

  <Accordion title="XOR" icon="not-equal">
    Exactly one of two sub-conditions holds. Niche but occasionally useful for state-detection.
  </Accordion>
</AccordionGroup>

## Time — trading hour gating

<AccordionGroup>
  <Accordion title="Within-window" icon="clock">
    Current time is within a specified window (e.g., `09:00–17:00`). Useful for trading only during high-liquidity hours.
  </Accordion>

  <Accordion title="After-time" icon="forward">
    Current time is after a threshold time. Useful for "no trading before market open."
  </Accordion>

  <Accordion title="Before-time" icon="backward">
    Current time is before a threshold time. Useful for "no trading after Friday 23:00."
  </Accordion>
</AccordionGroup>

<Tip>
  **Time-based filtering is underused in crypto.** Many operators don't think to filter by time-of-day, but crypto markets do have rhythms — London open, US open, weekend low-liquidity. Time conditions help avoid bad-fill periods.
</Tip>

## Volume — confirmation conditions

<AccordionGroup>
  <Accordion title="Above-average" icon="chart-column">
    Current volume is above its N-bar average. Confirms participation behind a price move.
  </Accordion>

  <Accordion title="Surge" icon="bolt">
    Current volume is N times the recent average (e.g., 2x or 3x). Detects unusual activity.
  </Accordion>

  <Accordion title="Dry-up" icon="droplet-slash">
    Current volume is below a threshold. Detects low-conviction periods.
  </Accordion>
</AccordionGroup>

## Volatility — regime detection

<AccordionGroup>
  <Accordion title="Within-band" icon="ruler-combined">
    Price is within Bollinger/Keltner bands. Normal volatility regime.
  </Accordion>

  <Accordion title="Outside-band" icon="ruler-combined">
    Price has broken outside bands. Tail-event detection.
  </Accordion>

  <Accordion title="Contracting" icon="compress">
    Bollinger Width is decreasing — squeeze setup forming.
  </Accordion>

  <Accordion title="Expanding" icon="expand">
    Bollinger Width is increasing — volatility rising.
  </Accordion>
</AccordionGroup>

## Statistical — rigorous thresholds

<AccordionGroup>
  <Accordion title="z-score-above / z-score-below" icon="square-root-variable">
    Indicator's z-score (normalized deviation from mean) above/below a threshold. Tail-event detection tied to actual recent distribution.

    Example: "z-score-above 2" fires when value is more than 2 standard deviations above its recent mean.
  </Accordion>

  <Accordion title="Percentile-threshold" icon="square-root-variable">
    Indicator's percentile rank over recent N bars meets a threshold.

    Example: "Bollinger Width is in the bottom 10th percentile" = squeeze setup.
  </Accordion>
</AccordionGroup>

## Best practices for condition design

<Tip>
  * ✅ **Start with simple comparisons** — `>`, `<`, `crossover`, `crossunder`. Easy to reason about.
  * ✅ **Add a trend filter to mean-reversion** — don't catch falling knives.
  * ✅ **Use ADX > 25 for trend-following** — only act when trend is real.
  * ✅ **Limit to 2–3 conditions per AND** — overfitting risk with more.
  * ✅ **Time-window filter for low-liquidity exclusion** — avoid weekend / overnight bad fills.
  * ✅ **Volume-surge confirmation for breakouts** — filters fakeouts.
  * ✅ **Statistical thresholds (z-score, percentile) for rigorous setups** — better than fixed numbers.
  * ✅ **Mirror entry conditions for exit** — symmetric logic for clean state management.
  * ✅ **Test each condition's contribution** — does adding it actually improve outcomes?
</Tip>

## What's next

<CardGroup cols={2}>
  <Card title="Indicators" icon="chart-line" href="/strategies/building-blocks/indicators">
    The 136 indicators that feed into conditions.
  </Card>

  <Card title="Triggers" icon="bolt" href="/strategies/building-blocks/triggers">
    The 4 trigger modes that gate firing.
  </Card>

  <Card title="Timeframes" icon="clock" href="/strategies/building-blocks/timeframes">
    The 15 timeframes you can anchor strategies to.
  </Card>

  <Card title="Strategy Recipes" icon="book" href="/strategies/recipes/overview">
    Worked examples using these conditions.
  </Card>
</CardGroup>
