Backtesting.Start optional algo parameters

Created at 07 Feb 2025, 13:55
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CL

claudiorubbiani

Joined 29.03.2021

Backtesting.Start optional algo parameters
07 Feb 2025, 13:55


Hi everyone,

the new backtesting features of cTrader 5 are amazing!

From my plugin, I want to backtest my algo and I able to pass all the parameters like symbol, starting capital and start and end backtest dates.

Something like this works really well:

BacktestingProcess backtestSession = ctraderEnvironment.Plugin.Backtesting.Start(wahooBacktest.WahooRobot, nextTask.SymbolName, nextTask.TimeFrame, nextTask.BacktestingSettings);
 

Since my Algo is accepting some parameters, I want to pass these parameters from the plugin: 

BacktestingProcess backtestSession = ctraderEnvironment.Plugin.Backtesting.Start(wahooBacktest.WahooRobot, nextTask.SymbolName, nextTask.TimeFrame, nextTask.BacktestingSettings, "My first Text parameter", 2, "My second Text parameter");
 

As soon as I add these optional parameters, my algo receives in input these values:

cTrader.Automate.Domain.Shared.Messaging.Serializable.SerializableAlgoParameterValue`1[System.String]

 

Could you please provide some guidance on how to create these parameters from the plugin? I also tried something like this

object[]  _myAlgoParameters  = new object[]

{
    "MySampleString",
    1,
    12345,
};

But nothing seems to work.

Thanks a lot and keep up the hard work.

---

Claudio

 


@claudiorubbiani
Replies

vanderlinde.jacques
10 Feb 2025, 12:34 ( Updated at: 14 Feb 2025, 18:21 )

Hi there,

I have the same problem, cannot change the bot's input parameter values when calling Backtesting.start.

I have currently the following:

object[] RobotParameters = new object[] {0.02, 1, 30};

theBacktestingProcess = Backtesting.Start(_selectedRobotType, "EURUSD", TimeFrame.Minute5, backtestingSettings,RobotParameters);

But when looking at the Backtesting results, I can see that it used the default parameters of the bot.

Please help!


@vanderlinde.jacques

vanderlinde.jacques
23 Feb 2025, 16:01

Hi,

Anyone that can help us?

Greetings

Jacques


@vanderlinde.jacques