# OpenBacktesting: Python backtesting framework

Write a Python strategy, run it on historical OHLC data, and inspect trades and performance. This manual is for people using the framework.

**[Run your first backtest →](https://docs.openbacktesting.com/quickstart/index.md)** — a complete script using bundled data, with no data download or application integration required.

## Choose your next task

| I want to… | Read |
| --- | --- |
| Load market data or set asset rules | [Data, timeframes, and instruments](https://docs.openbacktesting.com/reference/data/index.md) |
| Define entry and exit logic | [Strategy](https://docs.openbacktesting.com/reference/strategy/index.md) |
| Set cash, fees, and execution timing | [Backtest](https://docs.openbacktesting.com/reference/core/index.md) |
| Place, cancel, protect, or close trades | [Orders, Position, and Trade](https://docs.openbacktesting.com/reference/trading/index.md) · [Account and events](https://docs.openbacktesting.com/reference/events/index.md) |
| Calculate or compose indicators | [Indicator usage](https://docs.openbacktesting.com/reference/indicator-api/index.md) · [Full catalog](https://docs.openbacktesting.com/reference/indicators/index.md) |
| Make strategy parameters configurable | [Inputs](https://docs.openbacktesting.com/reference/inputs/index.md) |
| Read return, equity, and trade details | [Results](https://docs.openbacktesting.com/guides/results/index.md) · [Portfolio export](https://docs.openbacktesting.com/reference/portfolio/index.md) |
| Compare parameter values | [Best-run optimization](https://docs.openbacktesting.com/reference/core/index.md#find-a-parameter-combination) · [Saved experiments](https://docs.openbacktesting.com/reference/optimizer/index.md) |
| Add visuals or colors | [Plotting declarations](https://docs.openbacktesting.com/reference/plotting/index.md) · [Color](https://docs.openbacktesting.com/reference/colors/index.md) |
| Reuse signal/trailing strategies or resample data | [Helpers](https://docs.openbacktesting.com/reference/helpers/index.md) |
| Run a strategy file with declared defaults | [Decorator and runtime](https://docs.openbacktesting.com/reference/runtime/index.md) |

## How the pieces fit

1. Prepare a pandas DataFrame containing one asset's bars.
2. Define a `Strategy`: register indicators in `init()`, read the current bar and place orders in `next()`.
3. Construct `Backtest(data, MyStrategy, ...)` and call `.run(...)`.
4. Read statistics and execution tables, or export a Portfolio report.

`Order` tracks a request, `Trade` tracks one filled lot, and `Position` summarizes open exposure. An order normally executes at the next bar's open. Indicator values can be invalid during initial history; your strategy checks them before acting.

## Tutorials and scope

[First backtest](https://docs.openbacktesting.com/quickstart/index.md) · [Trading rules](https://docs.openbacktesting.com/guides/trading/index.md) · [Indicator recipes](https://docs.openbacktesting.com/guides/indicators/index.md) · [Runnable examples](https://docs.openbacktesting.com/examples/index.md)

The engine models one asset and one settlement currency per run. It exports plotting data but includes no chart renderer or live-trading connection. See [supported boundaries](https://docs.openbacktesting.com/limitations/index.md) before interpreting results.
