ChartRobots Summary The interface representing a chart Robot instances collection.Provides properties and events that allow for accessing various information about Robots attached to a chart.
Signature
public abstract interface ChartRobots
Namespace cAlgo.API
Examples Example 1 (C#) Example 2 (PYTHON)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 using cAlgo.API ;
namespace cAlgo.Robots ;
[Robot(AccessRights = AccessRights.None)]
public 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 ();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 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 ()
Methods Add (2) Add (1 of 2)
Summary
Adds a new Robot instance to a chart.
Signature
public abstract ChartRobot Add ( string name , object [] parameterValues )
Parameters
Name Type Description name string The name of a Robot. parameterValues object[] The Robot parameter values or an anonymous object that contains Robot parameter values.
Return Value
ChartRobot
Examples
Add (2 of 2)
Summary
Adds a new Robot instance to a chart.
Signature
public abstract ChartRobot Add ( RobotType type , object [] parameterValues )
Parameters
Name Type Description type RobotType The type of Robot, you can get RobotType from AlgoRegistry. parameterValues object[] The Robot parameter values or an anonymous object that contains Robot parameter values.
Return Value
ChartRobot
Examples
See Also
Remove Summary
Removes a Robot instance from a chart.
Signature
public abstract bool Remove ( ChartRobot robot )
Parameters
Name Type Description robot ChartRobot The ChartRobot to be removed from a chart.
Return Value
bool
Properties Item Signature
public abstract ChartRobot Item { get ;}
Return Value
ChartRobot
Count Summary
Gets the number of all Robots attached to a chart.
Signature
public abstract int Count { get ;}
Return Value
int
Events RobotAdded Summary
Occurs when a Robot is added to a chart.
Signature
public abstract event Action < ChartRobotAddedEventArgs > RobotAdded ;
RobotRemoved Summary
Occurs when a Robot is removed from a chart.
Signature
public abstract event Action < ChartRobotRemovedEventArgs > RobotRemoved ;
RobotModified Summary
Occurs when a chart Robot instance is modified.
Signature
public abstract event Action < ChartRobotModifiedEventArgs > RobotModified ;
RobotStarted Summary
Occurs when a chart Robot instance is started.
Signature
public abstract event Action < ChartRobotStartedEventArgs > RobotStarted ;
RobotStopped Summary
Occurs when a chart Robot instance is stopped.
Signature
public abstract event Action < ChartRobotStoppedEventArgs > RobotStopped ;