Actually just been running some tests. I have been eyeing out this OrderCloseBy() function for a while.
I don't do hedge Grid trading, but for those that are interested, here is some good ideas to pass on to your programmers....
There are 3 scripts attached to this post. Use the Open_Hedge_Trade script to open 30 trades on your demo account......make sure it is a big account cos it open 1 full lot per trade.
Run the Close_All script and note the time in the experts tab. Then Open the 30 trades again and run the Quick_Close script. Note the time in the experts tab. You will see the Quick_Close script closes all the trades about 50% - 100% quicker than the regular close script.
How does this work you ask? When a broker closes your trade he actually has to enter a trade for you in the opposite direction and this matching off take time. By using this OrderCLoseBy() function, you are telling the broker that there is a matching trade within your own account that you wish to close. This means that broker does not have to find a trading partner for you plus it kills 2 trades with 1 instruction.
Another benefit I can see here is that you would have no naked exposure in the market while you are closing one side of the hedge.
BTW, my times from my VPS were 6594 ms for the normal way and 4391 ms with the quick close. Also note the scripts are rough and dirty so there is no error handling and so on, they were just intended for demonstration purposes.
Wealth Creation Through Technology