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

# AI-powered backtesting: how Mobius simulates trades

> Mobius backtests strategies using real historical data and an AI that makes bar-by-bar trading decisions — the same AI used in live trading.

A backtest is a simulation of your trading strategy run against historical market data. Instead of risking real capital to test an idea, you replay the past and see how your strategy would have performed. Mobius backtests are powered by the same AI decision engine used in live trading, so what you test is what you deploy.

## How the backtest engine works

<Steps>
  <Step title="Data fetch">
    Mobius fetches OHLCV (Open, High, Low, Close, Volume) bars for your selected asset and date range from Alpaca Markets. For crypto, daily history is sourced from Yahoo Finance; intraday crypto bars use the Alpaca crypto feed.
  </Step>

  <Step title="Indicator calculation">
    All technical indicators referenced in your strategy (RSI, EMA, MACD, Bollinger Bands, etc.) are computed from the raw price data using TA-Lib. Alternative data (Reddit sentiment, congressional trades, fundamentals) is fetched from the appropriate provider and merged into the same timeline.
  </Step>

  <Step title="AI decision loop">
    For each bar in the date range, the AI receives: the current date, price, indicator values, and current position. It returns one of three actions — **buy**, **sell**, or **hold** — along with a reason and quantity. This decision loop runs bar by bar across the full backtest window.
  </Step>

  <Step title="Trade simulation">
    Buy and sell decisions are executed against the simulated portfolio. Commissions and slippage are applied as configured. The portfolio value is tracked at each bar.
  </Step>

  <Step title="Results">
    At the end of the simulation, Mobius calculates performance metrics and renders the equity curve.
  </Step>
</Steps>

## Performance metrics

| Metric            | What it measures                                                      |
| ----------------- | --------------------------------------------------------------------- |
| Total return      | Percentage gain or loss over the entire backtest period               |
| Annualized return | Return normalized to a one-year basis                                 |
| Sharpe ratio      | Risk-adjusted return — higher is better (above 1.0 is generally good) |
| Max drawdown      | Largest peak-to-trough decline in portfolio value                     |
| Win rate          | Percentage of trades that closed with a profit                        |
| Total trades      | Number of completed buy/sell pairs                                    |
| Average trade     | Average profit or loss per trade                                      |

## Supported timeframes

| Bar frequency | Best for            | Max backtest period |
| ------------- | ------------------- | ------------------- |
| 1 min         | Scalping, intraday  | 30 days             |
| 5 min         | Short-term intraday | 180 days            |
| 15 min        | Swing intraday      | 2 years             |
| 30 min        | Swing               | 3 years             |
| 1 hour        | Swing / trend       | 5 years             |
| Daily         | Long-term trend     | 5 years             |

## Important limitations

<Warning>
  **Past performance does not predict future results.** A strategy that backtests well may perform differently in live markets due to regime changes, liquidity differences, and market impact.
</Warning>

* Backtest data reflects historical prices — it does not account for corporate actions (splits, mergers) in all cases.
* Alternative data (Reddit sentiment, congressional trades) may have limited history before 2020.
* Fundamental data updates quarterly, so intraday fundamental strategies have lower granularity.

## Next steps

<CardGroup cols={2}>
  <Card title="Configure a backtest" icon="sliders" href="/guides/backtesting-config">
    Set capital, date range, slippage, and commission before running.
  </Card>

  <Card title="Interpret results" icon="chart-line" href="/guides/backtesting-config">
    Understand every metric in the backtest results panel.
  </Card>
</CardGroup>
