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

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

# BacktestingSettings (class)

Represents settings for configuring the backtesting process.

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 class BacktestingSettings
```

## Examples

C#:

```csharp
var settings = new BacktestingSettings
{
    StartTimeUtc = new DateTime(2025, 1, 1, 0, 0, 0, DateTimeKind.Utc),
    EndTimeUtc = new DateTime(2025, 6, 1, 0, 0, 0, DateTimeKind.Utc),
    Balance = 10000,
    DataMode = BacktestingDataMode.M1,
    SpreadPips = 0.5,
    ApplyCommissionAutomatically = true
};
if (AlgoRegistry.Get("Sample Trend cBot", AlgoKind.Robot) is RobotType robotType)
    Backtesting.Start(robotType, "EURUSD", TimeFrame.Hour, settings);
```

Python:

```python
from System import DateTime, DateTimeKind
settings = BacktestingSettings()
settings.StartTimeUtc = DateTime(2025, 1, 1, 0, 0, 0, DateTimeKind.Utc)
settings.EndTimeUtc = DateTime(2025, 6, 1, 0, 0, 0, DateTimeKind.Utc)
settings.Balance = 10000
settings.DataMode = BacktestingDataMode.M1
settings.SpreadPips = 0.5
settings.ApplyCommissionAutomatically = True
algoType = api.AlgoRegistry.Get("Sample Trend cBot", AlgoKind.Robot)
if algoType is not None:
    api.Backtesting.Start(RobotType(algoType), "EURUSD", TimeFrame.Hour, settings)
```

## Constructors

- `public BacktestingSettings()` — Represents settings for configuring the backtesting process. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/Constructor/index.md)

## Properties

- `public bool ApplyCommissionAutomatically {get; set;}` — Gets or sets a value that indicates whether the commission type and value of the backtested symbol are applied automatically. When it is set to true the Commission and CommissionType properties are ignored. The default value is false. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/ApplyCommissionAutomatically/index.md)
- `public double Balance {get; set;}` — Gets or sets the initial balance for the backtesting. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/Balance/index.md)
- `public double Commission {get; set;}` — Gets or sets the commission value, it is interpreted based on the CommissionType property value. It is ignored when ApplyCommissionAutomatically is set to true. The default value is 0. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/Commission/index.md)
- `public SymbolCommissionType CommissionType {get; set;}` — Gets or sets the commission type that defines how the Commission property value is interpreted. It is ignored when ApplyCommissionAutomatically is set to true. The default value is SymbolCommissionType.UsdPerMillionUsdVolume. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/CommissionType/index.md)
- `public string DataFile {get; set;}` — Gets or sets the path to the data file used for backtesting. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/DataFile/index.md)
- `public BacktestingDataMode DataMode {get; set;}` — Gets or sets the data mode used for backtesting. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/DataMode/index.md)
- `public DateTime EndTimeUtc {get; set;}` — Gets or sets the end time in UTC for the backtesting period. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/EndTimeUtc/index.md)
- `public MonteCarloSettings MonteCarlo {get; set;}` — Gets or sets the optional Monte Carlo simulation that runs on the completed backtest. When it is null, the default, no Monte Carlo simulation is performed and the backtest behaves exactly as before. When it is set, the simulation runs on the completed backtest and its result is written to the configured output file. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/MonteCarlo/index.md)
- `public bool PreciseConversion {get; set;}` — Gets or sets a value indicating whether historical data for additional symbols is downloaded to convert profit and margin into the account deposit currency precisely. When true, real historical exchange rates of the additional symbols are used; when false, the default, approximated rates are used. Enabling it can increase the run time and the amount of downloaded data. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/PreciseConversion/index.md)
- `public double SpreadPips {get; set;}` — Gets or sets the spread in pips. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/SpreadPips/index.md)
- `public DateTime StartTimeUtc {get; set;}` — Gets or sets the start time in UTC for the backtesting period. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/BacktestingSettings/StartTimeUtc/index.md)

## Deprecated members

- `public double CommissionUsdPerMillionUsd {get; set;}` — Use Commission with CommissionType instead

