![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I would like to perform an usual limit order which means,
that I'm willing to pay the limit price or less for buying something.
In MT4 I found two possibilities, which do NOT perform this:
1) OP_BUYLIMIT
OrderSend( Symbol(), OP_BUYLIMIT, 1, limitPrice, ...);
is not an usual limit order,
because when ask price triggers limit price
the order mutates to a market order and
a possible fill could be higher then my desired limit price :-(
https://book.mql4.com/trading/ordersend:
"... When the market price reaches the level of the open price requested for the pending order, there will be a check made on the server. If there are enough money on the account for opening this order, it will be modified into a market one (opened). If not, it will be deleted. ..."
2) OP_BUY
Using this:
if( Ask<=limitPrice ) OrderSend( Symbol(), OP_BUY, 1, Ask, ( limitPrice-Ask )/Point, ...);
garanties, that a possible fill is smaller or equal then limitPrice :-)
But I do not get a fill,
when the next Ask is smaller then 2*Ask-limitPrice (=price-slippage),
because the next Ask is out of range
(this is the case, when there is a very good ask price) :-(
MQL4 Reference -> Trading functions -> OrderSend:
"... the position will be opened at the current price and only if the current price lies within the range of price+-slippage."
Questions
Did I made any mistakes in understanding MT4 ?
Is there any work around for performing an usual limit order ?
Any idea, why limit orders in MT4 are that complicated ?
Thanks a lot
Ulrich