# Execution model

> How the engine fills trades, orders intrabar events, and why look ahead is impossible.

Source: https://docs.texttoquant.com/concepts/execution-model

---

A backtest is only as trustworthy as the assumptions inside it. Every strategy, typed in plain
English or assembled in the visual builder, compiles to the *same* engine, and where that engine
has to make a judgment call at bar resolution, it makes the **conservative** one: ambiguous
situations resolve against the trade, not in its favour. The goal is that a good result survives
scrutiny, not that results look good.

## Signals, entries and exits

- **Signals are evaluated on completed bars** (bar close). The engine never acts on a bar that is
  still forming.
- **Entries are edge triggered:** a condition must become true *having been false on the previous
  bar* to fire. "RSI above 50" fires once when it crosses, not on every bar the condition merely
  stays true.
- **Entry fills occur at the signal bar's close**, with configurable slippage applied against the
  trade direction.
- **Intrabar exit ordering is conservative:** stop losses are checked before profit targets on the
  same bar. A bar that touches both your stop and your target books the loss.
- **Fills are gap aware:** if a bar opens beyond a stop or target, the fill uses the open price,
  worse for a gapped stop, better for a gapped target, never the level the market skipped past.

## No look ahead

The single most important guarantee: a backtest can never use information it wouldn't have had live.

- **Multi timeframe and cross asset conditions read only the previous *completed* higher timeframe
  bar.** A 4-hour strategy consulting the daily trend sees yesterday's finished daily bar, never
  today's still forming one.
- **Monthly bars use true calendar closes**, not fixed width approximations.
- **Indicators are seeded with warm up data** before your requested start date, so a 200-period
  moving average is already correct on bar 1 of your window instead of spending the first months
  converging.

<Callout variant="warning" title="What a backtest cannot tell you">
  The intrabar price path is unknown at bar resolution. When one bar touches both a stop and a
  target, the engine resolves the conflict conservatively (the stop) rather than by tick data.
  Backtests are hypothetical and benefit from hindsight; past performance does not guarantee future
  results.
</Callout>

Related: [costs & fees](/docs/concepts/costs), [overfitting](/docs/concepts/overfitting),
[robustness reference](/docs/reference/robustness).
