Large groups of trades closing way too slowly

Created at 14 Jul 2015, 04:34
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!
NE

Neptune

Joined 13.06.2015

Large groups of trades closing way too slowly
14 Jul 2015, 04:34


I've developed a grid robot which is going fantastic on the EURUSD (very risky though) however I've got a slight problem. The grid of trades all close when overall they are in a certain profit that increases as the amount of open trades increases. The issue is that if I have say, 6 trades open and they are overall in profit $20 and use the following code:

                foreach (var position in Positions)
                {
                    ClosePosition(position);
                }

They close at a rate of about a trade every 0.5 seconds which overall takes 3 seconds to close them all. The issue here is that by the time the final trade has closed you could have potentially lost some of your profits or even be in a negative if the market moves fast enough. 

Is there a way to have them all close at once at around the same speed large groups of trades close when you press the Close All button in CTrader? 


@Neptune
Replies

Spotware
14 Jul 2015, 12:04

Dear Trader,

Please try to use:

ClosePositionAsync(position);

 


@Spotware

Neptune
14 Jul 2015, 13:31

Nice this works very well thankyou ;)


@Neptune