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

# Operators & Conditions

> How indicator values are transformed into conditions using operators in Trinigence.

## What operators and conditions are

Indicators by themselves only produce values.

**Operators and conditions** define how those values are interpreted and turned into decisions.

In Trinigence:

* indicators → produce values or states
* operators → compare or relate values
* conditions → resolve to true or false

Only conditions can trigger entries, exits, or filters.

***

## Conditions at a glance

A condition is any expression that evaluates to **true or false**.

Examples:

```text theme={null}
RSI(14) > 50
EMA(20) crosses above EMA(50)
ATR(14) > ATR(14) average
```

Conditions are evaluated deterministically on candle close.

***

## Comparison operators

Comparison operators compare two values.

Common operators:

* `>` greater than
* `<` less than
* `>=` greater than or equal
* `<=` less than or equal
* `==` equal to

Examples:

```text theme={null}
RSI(14) > 50
Close price < EMA(200)
```

***

## Crossover operators

Crossover operators detect **events**, not states.

Examples:

```text theme={null}
EMA(20) crosses above EMA(50)
RSI(14) crosses below 30
```

Crossovers:

* trigger only on the candle where the crossing occurs
* are not continuously true
* are commonly used for entries

<Info>
  Crossovers are event-based, not condition-based.
</Info>

***

## State conditions

State conditions describe ongoing situations.

Examples:

```text theme={null}
EMA(20) is above EMA(50)
MACD is above signal
Trend is bullish
```

State conditions:

* remain true across multiple candles
* are often used as filters
* define context rather than triggers

***

## Logical operators (AND / OR)

Multiple conditions can be combined using logical operators.

### AND

All conditions must be true.

```text theme={null}
RSI(14) > 50 AND EMA(20) > EMA(50)
```

### OR

At least one condition must be true.

```text theme={null}
RSI(14) < 30 OR price breaks previous low
```

<Warning>
  OR conditions can significantly increase trade frequency.
</Warning>

***

## Grouping conditions

Conditions can be grouped to control evaluation order.

Example:

```text theme={null}
(RSI(14) > 50 AND EMA(20) > EMA(50))
OR
(MACD crosses above signal)
```

Grouping prevents unintended logic behavior.

***

## Direction-aware conditions

Conditions may apply to:

* long entries only
* short entries only
* both directions

Example:

```text theme={null}
Go long when RSI(14) > 55.
Go short when RSI(14) < 45.
```

Each direction is evaluated independently.

***

## Evaluation timing

Conditions are evaluated:

* on candle close
* on the strategy timeframe
* once per candle

If a condition is true intrabar but false at close, it does not trigger.

***

## Defaults and assumptions

If operators or conditions are:

* explicit → used exactly
* implied but standard → ATI infers safely
* ambiguous → ATI asks for clarification

<Card title="What Trinigence fills automatically" icon="robot" href="/writing-ideas/what-trinigence-fills-automatically" horizontal>
  See how logic gaps are handled.
</Card>

***

## Common mistakes

<AccordionGroup>
  <Accordion title="Confusing crosses with states">
    Crosses are events. States persist over time.
  </Accordion>

  <Accordion title="Overusing OR logic">
    OR conditions can unintentionally flood a strategy with trades.
  </Accordion>

  <Accordion title="Forgetting grouping">
    Without grouping, logic may not behave as intended.
  </Accordion>
</AccordionGroup>

***

## Best practices

* Use crosses for entries
* Use states for filters
* Group complex logic explicitly
* Keep conditions readable

<Card title="Indicator categories" icon="layer-group" href="/indicators-logic/categories" horizontal>
  Explore indicators by type.
</Card>

***

## What to read next

<CardGroup cols={2}>
  <Card title="Indicator categories" icon="layer-group" href="/indicators-logic/categories">
    Trend, momentum, volatility, and more.
  </Card>

  <Card title="Entry logic" icon="arrow-right-to-bracket" href="/strategy-structure/entry-logic">
    How conditions trigger trades.
  </Card>

  <Card title="Schedule & filters" icon="calendar-days" href="/strategy-structure/schedule-and-filters">
    Restrict when conditions are allowed.
  </Card>

  <Card title="Indicators overview" icon="wave-square" href="/indicators-logic/overview">
    Return to the big picture.
  </Card>
</CardGroup>

<Note>
  Indicators produce signals.\
  Operators define meaning.\
  Conditions drive action.
</Note>
