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

# How Backtesting Works

> Understand what Trinigence backtesting simulates, what it assumes, and how to interpret results.

## What backtesting is

Backtesting simulates how a strategy would have behaved on historical market data.

In Trinigence, backtesting answers:

* **Did the strategy take trades as expected?**
* **What would the performance and risk look like historically?**
* **How stable is behavior across time?**

<Info>
  Backtesting is a simulation, not a guarantee of future performance.
</Info>

***

## What Trinigence backtesting simulates

A Trinigence backtest simulates, candle by candle:

1. evaluating strategy logic on each candle close
2. opening trades when entry conditions are met
3. closing trades when exit conditions are met
4. applying risk rules (stop loss, take profit, limits)
5. tracking performance metrics and trade history

The same inputs always produce the same results.

***

## What data is used

Backtests use historical candle data:

* Open
* High
* Low
* Close
* Volume (when available and used)

Results are always dependent on:

* the selected market (symbol)
* the selected timeframe
* the available data range

***

## Candle-close evaluation

By default, strategy logic is evaluated on **candle close**.

That means:

* entries trigger only if conditions are true at close
* exits trigger only if conditions are true at close
* crossovers trigger only if the crossover is present at close

<Warning>
  Intrabar behavior is not assumed unless explicitly supported.
</Warning>

***

## What the backtest does *not* guarantee

Backtests cannot fully replicate live conditions such as:

* slippage variations
* real-time liquidity changes
* exchange-specific execution quirks
* sudden outages and operational constraints

The purpose is to understand **logical behavior** and **historical distribution**, not to predict the future.

***

## Assumptions you should be aware of

Trinigence backtests operate under assumptions that keep behavior deterministic.

Common assumptions:

* strategy logic is evaluated deterministically per candle
* the same data produces the same trades
* no hidden discretionary decisions exist

When relevant, Trinigence surfaces assumptions used to complete a strategy.

<Card title="What Trinigence fills automatically" icon="robot" href="/writing-ideas/what-trinigence-fills-automatically" horizontal>
  See what the system infers to complete strategies.
</Card>

***

## Why results can look “wrong”

If a backtest doesn’t match your expectation, it usually comes from one of these:

<AccordionGroup>
  <Accordion title="Timeframe mismatch">
    Indicators and logic behave differently across timeframes. A 15m strategy is not a faster 1h strategy.
  </Accordion>

  <Accordion title="Too many filters">
    Filters can quietly eliminate most entries.
  </Accordion>

  <Accordion title="Missing intrabar expectations">
    If you expected intrabar triggers, candle-close evaluation will look delayed.
  </Accordion>

  <Accordion title="Exit logic dominates">
    Many strategies are controlled more by exits and risk rules than by entries.
  </Accordion>
</AccordionGroup>

***

## How to validate a backtest

Best practice validation flow:

<Steps>
  <Step title="Start with a simple baseline">
    Use a minimal strategy with clear entries and exits.
  </Step>

  <Step title="Inspect trade history">
    Look at individual trades before trusting metrics.
  </Step>

  <Step title="Add complexity one layer at a time">
    Add filters, schedules, and extra conditions gradually.
  </Step>

  <Step title="Compare across time ranges">
    Validate behavior in different market regimes.
  </Step>
</Steps>

***

## What to look at first

When reviewing results, start with:

* trade count and frequency
* win rate vs profit factor
* max drawdown and drawdown duration
* equity curve shape
* biggest wins/losses

<Card title="Backtesting metrics overview" icon="chart-column" href="/backtesting/metrics-overview" horizontal>
  Learn what each metric means and how to use it.
</Card>

***

## What to read next

<CardGroup cols={2}>
  <Card title="Metrics overview" icon="chart-column" href="/backtesting/metrics-overview">
    Interpret performance and risk metrics.
  </Card>

  <Card title="Trade history & logs" icon="list-check" href="/backtesting/trade-history-and-logs">
    Debug strategy behavior.
  </Card>

  <Card title="Common backtest pitfalls" icon="triangle-exclamation" href="/backtesting/common-pitfalls">
    Avoid misinterpretation.
  </Card>

  <Card title="Strategy structure" icon="diagram-project" href="/strategy-structure/overview">
    Understand what is being tested.
  </Card>
</CardGroup>

<Note>
  Backtesting answers: “What happened historically under clear rules?”\
  It does not answer: “What will happen tomorrow?”
</Note>
