Can't be done.
i had some check and i knew there is code allow to loop thru all open order and select the type of order to close , delete
however this is time confusing (i.e around 6 txn will took about 3 second) where its not feasible for me
i had see some example where people is closing the deal (i.e 15 deals) on exactly same time (same second)
would appreciate if anyone can guide me thru how to do that
If you use an asynchronous trade request, then about a thousand trade requests can be sent through MQL5 in one second. But even in this case, everything will depend on the speed at which trade orders are executed on the broker's server.
Example of asynchronous orders (one loop, no checks)
//+------------------------------------------------------------------+ //| Close All.mq5 | //| Copyright © 2016-2022, Vladimir Karputov | //| https://www.mql5.com/en/users/barabashkakvn | //+------------------------------------------------------------------+ #property copyright "Copyright © 2016-2022, Vladimir Karputov" #property link "https://www.mql5.com/en/users/barabashkakvn" #property version "1.009" //--- #include <Trade\PositionInfo.mqh> #include <Trade\Trade.mqh> CPositionInfo m_position; // trade position object CTrade m_trade; // trading object //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { m_trade.SetAsyncMode(true); for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties { if(m_position.PositionType()==POSITION_TYPE_BUY) { if(!m_trade.PositionClose(m_position.Ticket())) // close a position by the specified m_symbol Print(__FILE__," ",__FUNCTION__,", ERROR: ","BUY PositionClose ",m_position.Ticket(),", ",m_trade.ResultRetcodeDescription()); } if(m_position.PositionType()==POSITION_TYPE_SELL) { if(!m_trade.PositionClose(m_position.Ticket())) // close a position by the specified m_symbol Print(__FILE__," ",__FUNCTION__,", ERROR: ","SELL PositionClose ",m_position.Ticket(),", ",m_trade.ResultRetcodeDescription()); } } } //+------------------------------------------------------------------+

- www.mql5.com
Next time don't answer instead of giving a such answer. Nothing is impossible in programming especially the person said he saw it somewhere but you are still giving a very discouring answer while you are ignorent
If you use an asynchronous trade request, then about a thousand trade requests can be sent through MQL5 in one second. But even in this case, everything will depend on the speed at which trade orders are executed on the broker's server.
Example of asynchronous orders (one loop, no checks)
thank you , will give it a trial
i am just learning thru online open source and its kind of difficult thing
Next time don't answer instead of giving a such answer. Nothing is impossible in programming especially the person said he saw it somewhere but you are still giving a very discouring answer while you are ignorent
yeah, exactly . agree with you
can see most of his replies was on that pattern (in trading term , should call trend following)
guess he was just bored and sitting in pc everyday to finish his day
William answered correctly. It cannot be done. It is physically impossible, even in programming. Unfortunately what the person saw was false! Vladimir took it further and explained it in more detail, but he still mentioned that it cannot be done. So if you don't know or understand this, don't be so quick to jump to conclusions.
Just because William gave a short answer does not invalidate what he wrote. What he wrote is correct, and so is Vladimir. It cannot be done.
What you saw was false or a fluke. There is no way to force all positions to be closed together at once. You always have to loop through them one by one, whether that be in synchronous mode or asynchronous mode.
The asynchronous mode can make it seem faster on the client side (terminal), but the actual execution is still dependant on the server side (the broker).
So I will repeat what William stated: Can't be done.
William answered correctly. It cannot be done. It is physically impossible, even in programming. Unfortunately what the person saw was false! Vladimir took it further and explained it in more detail, but he still mentioned that it cannot be done. So if you don't know or understand this, don't be so quick to jump to conclusions.
what makes you think u knew all ?
how much u willing bet for me to show you its done ?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i had some check and i knew there is code allow to loop thru all open order and select the type of order to close , delete
however this is time confusing (i.e around 6 txn will took about 3 second) where its not feasible for me
i had see some example where people is closing the deal (i.e 15 deals) on exactly same time (same second)
would appreciate if anyone can guide me thru how to do that