"Buik operations" are not available via MQL code. You can recreate an equivalente procedure using a loop and asynchronous mode.
Forum on trading, automated trading systems and testing trading strategies
Experts: Close All Trade at Once
Fernando Carreiro, 2022.10.28 03:25
No, not even MT5 can do it all at once. What it does is use asynchronous mode to make it faster and seem like it is a bulk operation all at once.
Forum on trading, automated trading systems and testing trading strategies
Do you trade or have you ever traded “Boom” and “Crash”?
Fernando Carreiro, 2022.10.06 12:05
Such functionality is usually dependant on the strategy and is interwoven in the code, so I don't have anything separate that I can share.
The documentation however, has sample code in the documentation for TRADE_ACTION_CLOSE_BY
And @fxsaber has publish a library in the CodeBase for asynchronous order processing...
"Asynchronous trading orders have a huge advantage - high speed when sent in bulk. However, the spreading of such orders is hampered by the inconvenience - order result data can only be seen in OnTradeTransaction making users to build an event model of their trading strategy if they want asynchrony. This is not always easy (EAs), and sometimes even impossible (scripts).
The library solves this problem. At any time, it provides access to all transactions in the trading terminal (full data of the appropriate OnTradeTransaction) since the application launch simplifying the process of making your programs asynchronous."
"Buik operations" are not available via MQL code. You can recreate an equivalente procedure using a loop and asynchronous mode.
Thank you for replying. I really appreciate it. I will take a look and see if I can figure out how to use the asynchronous method.
Do you happen to know why the bulk operations are not available?
Thanks.
I suspect that the reason is because internally, that is exactly what it does—using asynchronous mode in a loop.
I suspect that the reason is because internally, that is exactly what it does—using asynchronous mode in a loop.
Thanks. I wonder about something though... I have an EA that I found online that uses the asynchronous method, but it is not open source, so I cannot say what else it does. However, and maybe this is just me, but when I use it, it does not seem to perform as well as the bulk operations within MT5. I suppose that there could be many reasons for this, though. Thanks, again.
If it's closed source, then how do you know if it uses asynchronous mode?
The answer is, it probably does NOT use asynchronous mode.
Yes, I understand that.
Thanks.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello.
I am an extreme newbie at this with no formal programming knowledge, so I apologize in advance.
I have created a very simple EA. The idea is to have two buttons that will make use of the 'Bulk Operations' commands for "Close All Positions" and "Delete All Orders". The reasoning for this is because the old methods that I have found are very slow and the Bulk Operations are very fast.
Unfortunately, I cannot understand how to implement these into my script. According to the MQL5 database, I should be using CExpert since it allows access to "CloseAll" and "DeleteOrders", which I assume is what I want for my buttons. Can someone guide me with this? I would really appreciate it. I have included images for reference. Thank you so much.