---
id: "T:cAlgo.API.BacktestingProcess"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/"
---

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

# BacktestingProcess (interface)

Represents a backtesting process with methods and properties to monitor its status and results.

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

- CLI: Available to plugins only, and plugins cannot run in the CLI.
- Cloud: Available to plugins only, and plugins cannot run in the cloud.

## Definition

```csharp
public interface BacktestingProcess
```

## 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.ProgressChanged += args => Print("Progress: {0:F1}%", args.Progress);
process.Completed += args => Print("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.ProgressChanged += lambda args: api.Print(f"Progress: {args.Progress:.1f}%")
process.Completed += lambda args: api.Print(f"Completed, error: {args.Process.BacktestingError}")
```

## Methods

- `void Terminate()` — Terminates the backtesting process. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/Terminate/index.md)

## Properties

- `BacktestingError BacktestingError {get;}` — Gets the error information if the backtesting process failed. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/BacktestingError/index.md)
- `string HtmlReport {get;}` — Gets the HTML report of the backtesting results. Returns null if the backtesting is not finished or an error occurred. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/HtmlReport/index.md)
- `bool IsCompleted {get;}` — Gets a value indicating whether the backtesting process is completed. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/IsCompleted/index.md)
- `string JsonReport {get;}` — Gets the JSON report of the backtesting results. Returns null if the backtesting is not finished or an error occurred. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/JsonReport/index.md)
- `string MonteCarloJsonReport {get;}` — Gets the Monte Carlo simulation result as JSON, which is the same snapshot that is written to the output file of the MonteCarlo settings. Returns null when no Monte Carlo simulation was configured, when the backtesting is not finished, when the backtest produced no trades, or when an error occurred. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/MonteCarloJsonReport/index.md)

## Events

- `event Action<BacktestingCompletedEventArgs> Completed;` — Occurs when the backtesting process is completed. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/Completed/index.md)
- `event Action<BacktestingProgressChangedEventArgs> ProgressChanged;` — Occurs when the backtesting progress changes. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingProcess/ProgressChanged/index.md)

