I have a problem in the terminology used my MQL4 book and documentation.
What does "to close an opened order" mean?
You're thinking too hard about it.
They are all orders, don't make a terminology distinction between orders and positions.
OrdersTotal() = Returns the number of market and pending orders
OrdersHistoryTotal() = Returns the number of closed orders in the account history loaded into the terminal
Thanks, but for different ideas, we use different terms. I am sure MQL4 documentation does the same, perhaps using different adjectives instead of different nouns.
How does the documentation refer to an "instruction to buy or sell a currency at a specified rate" and to the situation I am after this instruction was executed?
I'm not sure exactly what you are after. There is nothing in MQL4 language about "position".
Everything relates to Order... take a look at the list of trade functions. Nothing in there at all about managing "positions".
If you place a market order, it will remain an order forever. At no point (in MQL4) does the market order become a "position".
Hope that helps.
So just to verify if I am with you:
If I place a buy order, I have I pending order until somebody sells to me. At this moment, I have an opened order.
Is that alright?
If you want to place a market buy order you will use OrderSend(), which will send a request to the server resulting in either:
1. A buy order being opened (what you're calling a position); or
2. Failure (note: it won't persist as a pending order)
Have a read through the notes section of OrderSend() to get some more detailed information.
The request for a pending order is separate from a market order.
If you send a buy order (request), you will have a buy order (market) or nothing (if request fails).
With MT4 market orders and pending orders are all orders.
A pending order once triggered becomes a market order.
A pending order can't be closed, it can be delete (or cancelled).
A market order can be closed.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.