Skip to content

BacktestingProcess.MonteCarloJsonReport

property · BacktestingProcess · cAlgo.API Since 5.10

DesktopCLICloud

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.

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

string MonteCarloJsonReport {get;}
backtestingProcess.MonteCarloJsonReport: str

Returns string

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,
    MonteCarlo = new MonteCarloSettings(MonteCarloMethod.Reshuffle, @"C:\Temp\montecarlo-result.json")
};
var process = Backtesting.Start(robotType, "EURUSD", TimeFrame.Hour, settings);
process.Completed += args => Print("Monte Carlo result: {0}", args.Process.MonteCarloJsonReport);
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
settings.MonteCarlo = MonteCarloSettings(MonteCarloMethod.Reshuffle, r"C:\Temp\montecarlo-result.json")
process = api.Backtesting.Start(RobotType(algoType), "EURUSD", TimeFrame.Hour, settings)
process.Completed += lambda args: api.Print(f"Monte Carlo result: {args.Process.MonteCarloJsonReport}")