I make an “expert Advisor” for MT5, send orders asynchronously, filling out the MqlTradeRequest.
According to the documentation, type = ORDER_TYPE_BUY_LIMIT, action = TRADE_ACTION_PENDING. And, in principle, it works, but I notice that on demo accounts (I checked on two brokers), the deviation field is ignored. I.e., I set the price a little better than the market price, I set a large deviation to exactly cover the difference with a large margin, and the order is not executed, and hangs in the pending. Hence the question – should it work for penders, maybe it’s only for TRADE_ACTION_DEAL? I don’t see a clear answer in the documentation.