ChartRobots
interface cAlgo.API
DesktopCLICloud
The interface representing a chart Robot instances collection. Provides properties and events that allow for accessing various information about Robots attached to a chart.
Environment behaviour
Cloud — not supported. Always empty: Count is 0, Add returns null, Remove returns false, and the events never fire.
Definition
public interface ChartRobots
Namespace: cAlgo.API · Group: Robots
Examples
using cAlgo.API;
namespace cAlgo.Robots;
public partial class TestExample : Robot
{
protected override void OnStart()
{
foreach (var chartRobot in ChartRobots)
{
Print($"Name: {chartRobot.Name} | InstanceId: {chartRobot.InstanceId} | State: {chartRobot.State} | Type Name: {chartRobot.Type.Name}");
}
ChartRobots.RobotAdded += args => Print($"Robot added, {args.Robot.Name}");
ChartRobots.RobotRemoved += args => Print($"Robot removed, {args.Robot.Name}");
ChartRobots.RobotModified += args => Print($"Robot modified, {args.Robot.Name}");
ChartRobots.RobotStarted += args => Print($"Robot started, {args.Robot.Name}");
ChartRobots.RobotStopped += args => Print($"Robot stopped, {args.Robot.Name}");
var addedChartRobot = ChartRobots.Add("Sample Break Even");
addedChartRobot.Start();
}
}
import clr
clr.AddReference("cAlgo.API")
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
class Test():
def on_start(self):
for chartRobot in api.ChartRobots:
print(f"Name: {chartRobot.Name} | InstanceId: {chartRobot.InstanceId} | State: {chartRobot.State} | Type Name: {chartRobot.Type.Name}")
api.ChartRobots.RobotAdded += lambda args: print(f"Robot added, {args.Robot.Name}")
api.ChartRobots.RobotRemoved += lambda args: print(f"Robot removed, {args.Robot.Name}")
api.ChartRobots.RobotModified += lambda args: print(f"Robot modified, {args.Robot.Name}")
api.ChartRobots.RobotStarted += lambda args: print(f"Robot started, {args.Robot.Name}")
api.ChartRobots.RobotStopped += lambda args: print(f"Robot stopped, {args.Robot.Name}")
addedChartRobot = api.ChartRobots.Add("Sample Break Even")
addedChartRobot.Start()
{
"AccessRights": "None"
}
Methods
| Name | Description |
|---|---|
Add 2 overloadsDesktopCLICloudChartRobot | Adds a new Robot instance to a chart. |
RemoveDesktopCLICloudbool | Removes a Robot instance from a chart. |
Properties
| Name | Description |
|---|---|
CountDesktopCLICloudint | Gets the number of all Robots attached to a chart. |
ItemDesktopCLICloudChartRobot | Gets a Robot attached instance to a chart by its instance ID. |
Events
| Name | Description |
|---|---|
RobotAddedDesktopCLICloudAction<ChartRobotAddedEventArgs> | Occurs when a Robot is added to a chart. |
RobotModifiedDesktopCLICloudAction<ChartRobotModifiedEventArgs> | Occurs when a chart Robot instance is modified. |
RobotRemovedDesktopCLICloudAction<ChartRobotRemovedEventArgs> | Occurs when a Robot is removed from a chart. |
RobotStartedDesktopCLICloudAction<ChartRobotStartedEventArgs> | Occurs when a chart Robot instance is started. |
RobotStoppedDesktopCLICloudAction<ChartRobotStoppedEventArgs> | Occurs when a chart Robot instance is stopped. |