ChartRobots.Add
method · ChartRobots · cAlgo.API
DesktopCLICloud
Adds a new Robot instance to a chart.
Environment behaviour
Cloud — not supported. Always empty: Count is 0, Add returns null, Remove returns false, and the events never fire.
Overloads
Add(string name, object[] parameterValues)
Adds a new Robot instance to a chart.
ChartRobot Add(string name, object[] parameterValues)
api.ChartRobots.Add(name: str, parameterValues: list[object]) -> ChartRobot
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
name | string | str | The name of a Robot. |
parameterValues | object[] | list[object] | The Robot parameter values or an anonymous object that contains Robot parameter values. |
Returns ChartRobot — An ChartRobot representing the added Robot instance.
Examples
var martingaleBot = ChartRobots.Add("Sample Martingale cBot", 0.01, 10, 10);
var trendBot = ChartRobots.Add("Sample Trend cBot", new { Quantity = 0.01 });
martingaleBot.Start();
Print("Added {0} and {1}", martingaleBot.Name, trendBot.Name);
martingaleBot = api.ChartRobots.Add("Sample Martingale cBot", 0.01, 10, 10)
martingaleBot.Start()
api.Print(f"Added {martingaleBot.Name}")
Add(RobotType type, object[] parameterValues)
Adds a new Robot instance to a chart.
ChartRobot Add(RobotType type, object[] parameterValues)
api.ChartRobots.Add(type: RobotType, parameterValues: list[object]) -> ChartRobot
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
type | RobotType | RobotType | The type of Robot, you can get RobotType from AlgoRegistry. |
parameterValues | object[] | list[object] | The Robot parameter values or an anonymous object that contains Robot parameter values. |
Returns ChartRobot — An ChartRobot representing the added Robot instance.
Examples
if (AlgoRegistry.Get("Sample Martingale cBot", AlgoKind.Robot) is RobotType martingaleBotType)
{
var martingaleBot = ChartRobots.Add(martingaleBotType, new { InitialQuantity = 0.01, StopLoss = 10, TakeProfit = 10 });
Print("Added cBot: {0}", martingaleBot.Name);
}
martingaleBotType = api.AlgoRegistry.Get("Sample Martingale cBot", AlgoKind.Robot)
if martingaleBotType is not None:
martingaleBot = api.ChartRobots.Add(martingaleBotType, 0.01, 10, 10)
api.Print(f"Added cBot: {martingaleBot.Name}")
See also