CloseAll Fast

Created at 20 Jul 2017, 20:48
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!
swingfish's avatar

swingfish

Joined 25.06.2016

CloseAll Fast
20 Jul 2017, 20:48


is there a way to simulate the CoseALL button in cAlgo 

as looping trough positions does take way too long .. a algo needs 2 sec or more to close 5 sec. where the close all button just close all of them in almost realtime 

 


@swingfish
Replies

BeardPower
20 Jul 2017, 22:04

Use the async methods

Hi,

The "close all" is just an asynchronously call.
You need to use the async functions. These functions do not wait until the position is actually closed. They just send a message to the server to close the position.
The "close all" button does not close them in real-time. It just sends the messages in near real-time. The positions itself can still take 5 seconds to close.

/api/reference/robot/closepositionasync


@BeardPower

swingfish
21 Jul 2017, 02:15

hello there and thank you

that did the job, 

the aim is to get rid of the orders as fast as possible to maintain the target price .. waiting for sync does have advantages, but in this case its better to get the commands out fast .. 

 

Async did the job, sure i still have the lag but all orders are sent already and the server has to deal with it .. thats a huge advantage.

thanks again 

 


@swingfish