Order:
No mater if it is pending or market, everything starts with the placement of an "Order".
A pending order waits for a certain condition to be met, while a market order takes on immediate effect.
Filling Policy:
When the order is triggered (now or later), it needs to be "filled", either entirely or partially, or not at all (cancelled). How this is done is defined by the "Filling Policy".
Deals:
In order to fill the orders, according to the policy, "Deals" are carried out. It can be a single deal or multiple deals.
Position:
After the deal or deals are carried out, the result is a "Position".
A simple way to view it ... Basic Principles - Trading Operations - MetaTrader 5 Help
- Order — the request (current and history)
- Deal — the action (history)
- Position — the result (current)
Orders, Positions and Deals in MetaTrader 5
MetaQuotes, 2011.02.01 16:13
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
- www.metatrader5.com
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
there are some changes in MQL5 compare to MQL4 that i had trouble fully understand them
1. Order and Position
i read that there are order, deal, and position (and filling?). i had trouble understanding it fully. but at least in MQL5 i understand that i need to use Order when dealing with pending order and use Position when dealing with open order (buy/sell only). is it safe to assume that way without knowing how this thing actually works?
2. Filling policy
i'll use the case opening 0.1 lot buy to explain how i think what is going on
Fill or Kill; - if i buy 0.1 lot, either i have 1 position with 0.1 volume or no position at all
Immediate or Cancel; - if i buy 0.1 lot during high price movement, there is a chance i have no open position, or 1 position with a random lot range 0.01-0.1 depending on if the price is equal to my OrderSend and my slippage setting. (if this understanding is correct, i wonder why the system need to deal 0.01 10 times rather than 0.1 at once. and if my slippage is high, is it possible to have up to 10 0.01 position at different price? if not, then yes i still don't understand at all)
Passive (Book or Cancel); - it send 0.1 lot buylimit order. if it succes, i have 1 order 0.1 lot buylimit. if somehow the price going down too fast until it reach the same price at my buylimit order, it won't open a pending order. (if my understanding is correct, i don't understand the need to use this. placing a buylimit too close to the current price won't open any pending trade anyway)
Return; - "In case of partial filling, an order with remaining volume is not canceled but processed further". i have no idea what this is. is it the partially close, like from 0.1 already opened buy position, only closing 0.04 opened buy, so now i have the remaining 0.06 opened buy lot? (or it's like the IoC type but it still opening a position instead of canceling it? ignore this part if my understanding about IoC above is incorrect)
and if let's say i want to create a martingale EA, i must use FoK type? since if the first trade is 0.01 and i want to open twice 0.02 next, i have to make sure the next order lot must be twice cannot be partially opened? so far i feel like FoK type is the only one works for me even when opening a pending limit order. because i don't want my EA behave unpredictably