Fail-Safe Robot

08 Nov 2012, 13:19Fail-Safe Robot#1
Obi Celestineposts: 67since: 25 Oct 2012


Thanks guys for your support so far,my new project is a Robot that manages all positions when other Robots fail due to an error.The robot will only modify the stoploss of all positions on the account.I want to know how this will affect the other Robots if active on same account especially the last Robot you helped me with.

Kind regards

08 Nov 2012, 15:17#2
Spotware Support posts: 400since: 01 Jan 2012

Since this robot will modify all positions in the account then it will affect all positions even the ones that have been opened (or will be opened) by the still active robots.

If you want the fail-safe robot to only manage the positions opened by the robots that failed then you may do it by writing their position id's to a file on the OnError event and then stop the robot with the Stop() method.

The fail-safe robot can read this file and keep track of the positions modified thus far in a list.

The other robots will also need to implement lists with all active positions, unless each robot opens only one position at a time.

For more information on implementing lists see this example: /forum/calgo-reference-samples/56 and for an example on writing to a file see this: /forum/calgo-reference-samples/54 

Reading from a file is also done in a simple way. We will add an example that reads and writes to a file.

This logic may not allow for much flexibility, since it stops the robot OnError and that does not mean that the robot has failed.
You may implement this according to your desired strategy and ask us for any help that you need.