> ## 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.

# Entry Logic

> How Trinigence evaluates conditions to open a trade.

## What entry logic is

Entry logic defines **when a trade is opened**.

It answers one question:

> Under which exact conditions should a position be opened?

Entry logic must be:

* objective
* deterministic
* unambiguous

If the entry condition is met, the trade opens. If not, nothing happens.

***

## Components of entry logic

Entry logic is built from a combination of components.

<Columns cols={2}>
  <Card title="Conditions" icon="check">
    Indicator values, thresholds, or events that must occur.
  </Card>

  <Card title="Operators" icon="code-branch">
    Logical connectors like AND / OR.
  </Card>

  <Card title="Filters" icon="filter">
    Additional constraints that limit when entries are allowed.
  </Card>

  <Card title="Direction" icon="arrows-up-down">
    Whether the entry applies to long, short, or both.
  </Card>
</Columns>

***

## Conditions

Conditions are the building blocks of entries.

Examples:

```text theme={null}
RSI(14) > 50
EMA(20) crosses above EMA(50)
Price breaks above previous high
```

Conditions can reference:

* indicators
* price action
* volume
* time-based events

***

## Logical operators

Multiple conditions can be combined using logical operators.

Examples:

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

```text theme={null}
RSI(14) > 50 OR MACD > signal
```

<Info>
  All conditions must be explicitly true or false at evaluation time.
</Info>

***

## Filters

Filters restrict *when* entries are allowed, without defining the entry itself.

Common filters:

* higher timeframe trend
* session/time-of-day
* volatility conditions
* market regime

Example:

```text theme={null}
Only allow long entries when the 4h trend is bullish.
```

Filters are evaluated **before** entry conditions.

***

## Direction-specific entries

Entries can be defined separately for each direction.

Example:

```text theme={null}
Go long when EMA(20) crosses above EMA(50).
Go short when EMA(20) crosses below EMA(50).
```

Each direction:

* has independent logic
* may trigger at different times
* may use different conditions

***

## When entries are evaluated

Entry logic is evaluated:

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

If the condition becomes true intrabar but is false at close, **no trade opens**.

<Warning>
  Entries do not trigger intrabar unless explicitly supported.
</Warning>

***

## Default assumptions

If entry logic is:

* incomplete → ATI will request clarification
* implied but clear → ATI may infer safely
* ambiguous → no strategy is created

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

***

## Common mistakes

<AccordionGroup>
  <Accordion title="Conditions that are too restrictive">
    Too many AND conditions can eliminate all trades.
  </Accordion>

  <Accordion title="Using OR without intent">
    OR conditions can drastically increase trade frequency.
  </Accordion>

  <Accordion title="Expecting intrabar behavior">
    Entries are evaluated on candle close by default.
  </Accordion>
</AccordionGroup>

***

## Best practices

* Start with one clear condition
* Add filters gradually
* Inspect entry points visually
* Validate logic on a small dataset first

<Card title="Exit logic" icon="arrow-right-from-bracket" href="/strategy-structure/exit-logic" horizontal>
  Learn how trades are closed.
</Card>

***

## What to read next

<CardGroup cols={2}>
  <Card title="Exit logic" icon="arrow-right-from-bracket" href="/strategy-structure/exit-logic">
    How trades are closed.
  </Card>

  <Card title="Risk management" icon="shield-halved" href="/strategy-structure/risk-management">
    How losses are controlled.
  </Card>

  <Card title="Direction: long & short" icon="arrows-up-down" href="/strategy-structure/direction-long-short">
    Direction-specific behavior.
  </Card>

  <Card title="Strategy overview" icon="diagram-project" href="/strategy-structure/overview">
    Return to the big picture.
  </Card>
</CardGroup>

<Note>
  Good entries create opportunity.\
  Good exits and risk management create survival.
</Note>
