BacktestingProcess
interface cAlgo.API
DesktopCLICloud
Represents a backtesting process with methods and properties to monitor its status and results.
Environment behaviour
CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.
Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.
Definition
public interface BacktestingProcess
Namespace: cAlgo.API · Group: Backtesting
Examples
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);
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
| Name | Description |
|---|---|
TerminateDesktopCLICloudvoid | Terminates the backtesting process. |
Properties
| Name | Description |
|---|---|
BacktestingErrorDesktopCLICloudBacktestingError | Gets the error information if the backtesting process failed. |
HtmlReportDesktopCLICloudstring | Gets the HTML report of the backtesting results. Returns null if the backtesting is not finished or an error occurred. |
IsCompletedDesktopCLICloudbool | Gets a value indicating whether the backtesting process is completed. |
JsonReportDesktopCLICloudstring | Gets the JSON report of the backtesting results. Returns null if the backtesting is not finished or an error occurred. |
MonteCarloJsonReportDesktopCLICloudstring | 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. |
Events
| Name | Description |
|---|---|
CompletedDesktopCLICloudAction<BacktestingCompletedEventArgs> | Occurs when the backtesting process is completed. |
ProgressChangedDesktopCLICloudAction<BacktestingProgressChangedEventArgs> | Occurs when the backtesting progress changes. |