---
id: "P:cAlgo.API.Plugin.Backtesting"
kind: "property"
type: "T:cAlgo.API.Plugin"
url: "https://help.ctrader.com/ctrader-algo/references/General/Plugin/Backtesting/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Plugin.Backtesting

Member of [Plugin](https://help.ctrader.com/ctrader-algo/references/General/Plugin/index.md).

## Backtesting

Provides access to cBot backtesting from plugins, including custom backtesting data sources.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Plugins cannot run in the CLI: ctrader-cli runs cBots only.
- Cloud: Plugins cannot run in the cloud: it runs cBots only.

C#:

```csharp
public Backtesting Backtesting {get;}
```

Python:

```python
api.Backtesting: Backtesting
```

### Returns

`Backtesting` — 

### Examples

C#:

```csharp
if (AlgoRegistry.Get("Sample Trend cBot", AlgoKind.Robot) is not RobotType robotType)
    return;
var settings = new BacktestingSettings { StartTimeUtc = new DateTime(2025, 1, 1), EndTimeUtc = new DateTime(2025, 2, 1), Balance = 10000 };
var process = Backtesting.Start(robotType, "EURUSD", TimeFrame.Hour, settings);
process.Completed += args => Print("Backtesting completed, error: {0}", args.Process.BacktestingError);
```

Python:

```python
from System import DateTime
algoType = api.AlgoRegistry.Get("Sample Trend cBot", AlgoKind.Robot)
if algoType is None:
    return
settings = BacktestingSettings()
settings.StartTimeUtc = DateTime(2025, 1, 1)
settings.EndTimeUtc = DateTime(2025, 2, 1)
settings.Balance = 10000
process = api.Backtesting.Start(RobotType(algoType), "EURUSD", TimeFrame.Hour, settings)
process.Completed += lambda args: api.Print(f"Backtesting completed, error: {args.Process.BacktestingError}")
```

