# The pipeline

> One flow from a plain English idea to scored metrics, no manual wiring.

Source: https://docs.texttoquant.com/start/pipeline

---

Every backtest follows the same path: your sentence becomes a structured strategy, the strategy runs
bar by bar against real data, and you get a report. Nothing is wired by hand, and nothing about the
scoring is left to the AI.

## The five stages

| Stage | What happens |
| --- | --- |
| Query | You describe the strategy in natural language |
| Parsed | The query compiles deterministically into a structured spec (conditions, stops, sizing) |
| Indicators | Every indicator the spec references is computed: engine built ins and any custom series |
| Backtest | A bar by bar simulation opens and closes trades using only closed bar data |
| Output | Metrics, an annotated chart, the trade ledger, robustness checks and a grade |

## What the engine does

<Steps>
  <Step n={1} title="Load data">
    OHLC candles plus any market data the strategy needs (funding, open interest, cross asset series).
  </Step>
  <Step n={2} title="Compute indicators">
    Built in indicators and your custom series, aligned to the strategy's timeframe.
  </Step>
  <Step n={3} title="Evaluate conditions">
    Entry and exit trees are checked on each closed bar; stops and targets are tracked continuously.
  </Step>
  <Step n={4} title="Simulate trades">
    Positions open and close with realistic fills, producing trades, an equity curve and P&L.
  </Step>
</Steps>

<RunInTerminal query="Buy when RSI crosses above 50 and exit below 50 for BTC 1D from 1/1/2024 to 3/31/2024" />

<Callout variant="success" title="Deterministic by construction">
  The AI parses your words but never scores the result. The same query compiles to the same spec
  fingerprint, which the same engine scores identically every time, so a run is reproducible, and
  the AI can't steer toward a good looking number.
</Callout>

Next: learn the [shape of a query](/docs/start/query-shape), or jump to the
[Metrics reference](/docs/reference/metrics) to read a report.
