Multiple Robots

Created at 18 Sep 2012, 11:15
SpotTrader's avatar

Spot Trader

Joined 18.09.2012

Multiple Robots
18 Sep 2012, 11:15

Can I run multiple robots at the same time?


Spotware Support
19 Sep 2012, 15:31

Hello SpotTrader,


Yes you can but make sure that the code of one Robot does not affect the other. For instance one Robot may be closing all positions that are open for the account.

You may use a List to keep track of the positions that each robot is creating and closing:


// Declaration
private readonly List _positions = new List();

// OnPositionOpened
protected override void OnPositionOpened(Position openedPosition)
// OnPositionClosed
protected override void OnPositionClosed(Position closedPosition)
      if (_positions.Contains(closedPosition))
// access within OnTick/OnBar foreach (Position position in _positions ) { // do something e.g. if(position.NetProfit < ProfitLevel) Trade.Close(position); }





21 Oct 2012, 08:37

so there is no magic number or something similar to separate the robots?  If you have 20 bots running, you are relying only on figuring out which one opened a position with the list code that you have listed which i assume will need to be in every bot?


Spotware Support
22 Oct 2012, 11:14

We are currently working on introducing "labels" in cAlgo that will have the functionality of identifying robots.  It will be available very soon, stay tuned!


Best Regards