Skip to content

Robot

Summary

Base class for all cBots.

Remarks

Provides a convenient framework for creating cBots including methods to create, modify, cancel orders and close positions, methods triggered by each tick and each bar, access to built-in Indicators and more.

Signature

1
public class Robot : Algo

Namespace

cAlgo.API

Methods

Name Description
PlaceStopLimitOrderAsync Place Stop Limit order in asynchronous execution mode
PlaceStopOrder Place stop order in asynchronous execution mode
PlaceStopOrderAsync Place stop order in asynchronous execution mode
ExecuteMarketOrderAsync Execute a market order in asynchronous execution mode
ExecuteMarketRangeOrder Execute a Market Order
ExecuteMarketRangeOrderAsync Execute a market order in asynchronous execution mode
CancelPendingOrder Cancel a Pending Order
ModifyPendingOrder Modify a Pending Order in asynchronous execution mode
CancelPendingOrderAsync Cancel a Pending Order in asynchronous execution mode
ModifyPendingOrderAsync Modify a Pending Order in asynchronous execution mode
ReversePosition Modify the direction of trade and volume of a position
ModifyPosition Modify the protection of a position
ClosePosition Close a position
ClosePositionAsync Close a position in asynchronous execution mode
ReversePositionAsync Modify Position in asynchronous execution mode
ModifyPositionAsync Modify Position in asynchronous execution mode
PlaceStopLimitOrder Place Stop Limit order in asynchronous execution mode
Stop Stops the cBot. cBot will be completely stopped and will not send/receive any signals.
ToString Returns the cBot class name
PlaceLimitOrder Place limit order in asynchronous execution mode
PlaceLimitOrderAsync Place limit order in asynchronous execution mode
ExecuteMarketOrder Execute a market order in asynchronous execution mode

Properties

Name Description
Account { get; } Contains all Account information
LastResult { get; } The latest trade result
Trade { get; }

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 namespace cAlgo.Robots
 {
 [Robot]
 public class myCBot : Robot
 {
     protected override void OnStart()
     {
         //This method is called when the cBot is being started, once.
     }
     protected override void OnBar()
     {
         // Called on each incoming Bar.
     }
     protected override void OnTick()
     {
         // Called on each incoming tick.
     }
     protected override void OnError(Error error)
     {
         Print("There has been an Error");
     }
     protected override void OnStop()
     {
         //This method is called when the cBot is being stoped.
     }
}

Last update: March 23, 2023