Fail-Safe Robot

Created at 08 Nov 2012, 13:19
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Uche's avatar

Uche

Joined 25.10.2012

Fail-Safe Robot
08 Nov 2012, 13:19


Hello

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


@Uche
Replies

admin
08 Nov 2012, 15:17

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.

 

 


@admin