Tell your programmer to use the OrderOpen method rather than the BuyLimit or SellLimit methods. More importantly, specifying a TP value will result in a market (rather than limit) order being placed when TP is reached, no matter which method is used. To overcome this, use an OpenOrder with 0 TP value and when the position is opened, issue the corresponding closing limit order (TP) using OpenOrder.
This does not work. I tried this code multiple times and the specified price is not getting respected.
res=trade.OrderOpen("MESH23", ORDER_TYPE_BUY_LIMIT, 1, 0, 4022.75, 0, 0);
Actual filled price: 4023.
I'm using AMP Demo account and for some reason limit orders are not real limit orders, they're triggered as a market order when the order is touched. I even tried MqlTradeRequest with deviation 0, no difference. Tried BuyLimit/SellLimit, no difference.
This does not happen when trading on TradingView with the same broker and it does not happen when trading on MotiveWave, there they're always filled at the specified price as they should be. Why on earth can't MT5 place real limit orders? A limit order should not be filled at a price that isn't SPECIFIED, then it isn't a limit order. I don't know if this is a problem with AMP or MT5 actually. Can anyone confirm if this happens with other brokers on MT5?
I'm super close to changing platform completely but I don't actually want to change broker unless I really have to, so if anyone has a solution for this problem I would love to hear it.
I already emailed AMP futures support but of course they just gave the link to their support page which explains nothing about what's going on MT5 specifically, just talking about bracket orders, I haven't even touched a bracket order.
Last edited: