Hello I am working on developing an EA, but have trouble with getting the right number of deals.
My EA needs to detect when there is an open deal and prevent it from getting another order or deal through, but I cannot get the number of deals or detect if there are any open deals? Can anyone advice me on it? I tried using what I found:
But it still does not detect the correct number of open deals. Is there any easy way to detect the number of open deals accurately?
Thank you.
You want to know the open deals, but you're looking to the closed "history" deals
use OrdersTotal() not ...... and then select Symbol,....
You want to know the open deals, but you're looking to the closed "history" deals
use OrdersTotal() not ...... and then select Symbol,....
- www.mql5.com
OrdersTotal
Returns the number of current orders.
int OrdersTotal(); |
Return Value
Value of the int type.
Note
Do not confuse current pending orders with positions, which are also displayed on the "Trade" tab of the "Toolbox" of the client terminal. An order is a request to conduct a transaction, while a position is a result of one or more deals.
For each symbol, at any given moment of time, only one position can be open, while there can be several pending orders for the same symbol.
See also
OrdersTotal
Returns the number of current orders.
int OrdersTotal(); |
Return Value
Value of the int type.
Note
Do not confuse current pending orders with positions, which are also displayed on the "Trade" tab of the "Toolbox" of the client terminal. An order is a request to conduct a transaction, while a position is a result of one or more deals.
For each symbol, at any given moment of time, only one position can be open, while there can be several pending orders for the same symbol.
See also
Exactly it gives the number of orders not the actual deals. From my understanding, you can have asynchronous signals. So my EA can have multiple order requests but not all of the end up as actual deals. Orders are sent to server to generate deals correct? And deals are the actual trades, yes? I need the number of deals not orders.
I am maybe misunderstanding the concept of this but please if you can clarify it for me. I want to have just one deal open at all times so I need to check and make sure that I only have one actual deal not how many orders my EA has put with the server.
Thank you very much.
This thread may have useful info to find current open deals.
Thank you both, this made it more clear on what I need to do.
- 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 working on developing an EA, but have trouble with getting the right number of deals.
My EA needs to detect when there is an open deal and prevent it from getting another order or deal through, but I cannot get the number of deals or detect if there are any open deals? Can anyone advice me on it? I tried using what I found:
But it still does not detect the correct number of open deals. Is there any easy way to detect the number of open deals accurately?
Thank you.